Enabling extra bridge for native external network
[apex.git] / build / nics-template.yaml.jinja2
1 heat_template_version: 2015-04-30
2
3 description: >
4   Software Config to drive os-net-config to configure multiple interfaces
5   for the {{ role }} role.
6
7 parameters:
8   ControlPlaneIp:
9     default: ''
10     description: IP address/subnet on the ctlplane network
11     type: string
12   ExternalIpSubnet:
13     default: ''
14     description: IP address/subnet on the external network
15     type: string
16   InternalApiIpSubnet:
17     default: ''
18     description: IP address/subnet on the internal API network
19     type: string
20   StorageIpSubnet:
21     default: ''
22     description: IP address/subnet on the storage network
23     type: string
24   StorageMgmtIpSubnet:
25     default: ''
26     description: IP address/subnet on the storage mgmt network
27     type: string
28   TenantIpSubnet:
29     default: ''
30     description: IP address/subnet on the tenant network
31     type: string
32   ManagementIpSubnet: # Only populated when including environments/network-management.yaml
33     default: ''
34     description: IP address/subnet on the management network
35     type: string
36   ExternalNetworkVlanID:
37     default: 10
38     description: Vlan ID for the external network traffic.
39     type: number
40   InternalApiNetworkVlanID:
41     default: 20
42     description: Vlan ID for the internal_api network traffic.
43     type: number
44   StorageNetworkVlanID:
45     default: 30
46     description: Vlan ID for the storage network traffic.
47     type: number
48   StorageMgmtNetworkVlanID:
49     default: 40
50     description: Vlan ID for the storage mgmt network traffic.
51     type: number
52   TenantNetworkVlanID:
53     default: 50
54     description: Vlan ID for the tenant network traffic.
55     type: number
56   ManagementNetworkVlanID:
57     default: 60
58     description: Vlan ID for the management network traffic.
59     type: number
60   ExternalInterfaceDefaultRoute:
61     default: '10.0.0.1'
62     description: default route for the external network
63     type: string
64   ControlPlaneSubnetCidr: # Override this via parameter_defaults
65     default: '24'
66     description: The subnet CIDR of the control plane network.
67     type: string
68   ControlPlaneDefaultRoute: # Override this via parameter_defaults
69     description: The default route of the control plane network.
70     type: string
71   DnsServers: # Override this via parameter_defaults
72     default: []
73     description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
74     type: comma_delimited_list
75   EC2MetadataIp: # Override this via parameter_defaults
76     description: The IP address of the EC2 metadata server.
77     type: string
78
79 resources:
80   OsNetConfigImpl:
81     type: OS::Heat::StructuredConfig
82     properties:
83       group: os-apply-config
84       config:
85         os_net_config:
86           network_config:
87             -
88             {%- if not nets['external'][0]['enabled'] or nets['tenant']['nic_mapping'][role]['vlan'] is number or nets['storage']['nic_mapping'][role]['vlan'] is number or nets['api']['nic_mapping'][role]['vlan'] is number or  nets['external'][0]['nic_mapping'][role]['vlan'] is number %}
89               type: ovs_bridge
90             {%- if nets['external'][0]['enabled'] and nets['external'][0]['nic_mapping'][role]['vlan'] == 'native' %}
91               name: br-isolated
92             {%- else %}
93               name: {get_input: bridge_name}
94             {%- endif %}
95               members:
96                 -
97                   type: interface
98                   name: {{ nets['admin']['nic_mapping'][role]['members'][0] }}
99                   # force the MAC address of the bridge to this interface
100                   primary: true
101                 {%- if nets['external'][0]['enabled'] and nets['external'][0]['nic_mapping'][role]['vlan'] is number %}
102                 -
103                   type: vlan
104                   vlan_id: {get_param: ExternalNetworkVlanID}
105                   addresses:
106                   -
107                     ip_netmask: {get_param: ExternalIpSubnet}
108                   routes:
109                     -
110                       default: true
111                       next_hop: {get_param: ExternalInterfaceDefaultRoute}
112                 {%- endif %}
113                 {%- if nets['tenant']['enabled'] and nets['tenant']['nic_mapping'][role]['vlan'] is number %}
114                 -
115                   type: vlan
116                   vlan_id: {get_param: TenantNetworkVlanID}
117                   addresses:
118                     -
119                       ip_netmask: {get_param: TenantIpSubnet}
120                 {%- endif %}
121                 {%- if nets['storage']['enabled'] and nets['storage']['nic_mapping'][role]['vlan'] is number %}
122                 -
123                   type: vlan
124                   vlan_id: {get_param: StorageNetworkVlanID}
125                   addresses:
126                     -
127                       ip_netmask: {get_param: StorageIpSubnet}
128                 {%- endif %}
129                 {%- if nets['api']['enabled'] and nets['api']['nic_mapping'][role]['vlan'] is number %}
130                 -
131                   type: vlan
132                   vlan_id: {get_param: InternalApiNetworkVlanID}
133                   addresses:
134                     -
135                       ip_netmask: {get_param: InternalApiIpSubnet}
136                 {%- endif %}
137             {%- else %}
138               type: {{ nets['admin']['nic_mapping'][role]['phys_type'] }}
139               {%- if nets['admin']['nic_mapping'][role]['phys_type'] == 'linux_bridge' %}
140               name: br-ctlplane
141               members:
142                 -
143                   type: interface
144                   name: {{ nets['admin']['nic_mapping'][role]['members'][0] }}
145                   primary: true
146               {%- else %}
147               name: {{ nets['admin']['nic_mapping'][role]['members'][0] }}
148               {%- endif %}
149             {%- endif %}
150               use_dhcp: false
151               dns_servers: {get_param: DnsServers}
152               addresses:
153                 -
154                   ip_netmask:
155                     list_join:
156                       - '/'
157                       - - {get_param: ControlPlaneIp}
158                         - {get_param: ControlPlaneSubnetCidr}
159               routes:
160                 -
161                   ip_netmask: 169.254.169.254/32
162                   next_hop: {get_param: EC2MetadataIp}
163                 {%- if external_net_af == 6 or role == 'compute' or not nets['external'][0]['enabled'] %}
164                 -
165                   default: true
166                   next_hop: {get_param: ControlPlaneDefaultRoute}
167                 {%- endif %}
168
169             {%- if nets['tenant']['enabled'] and nets['tenant']['nic_mapping'][role]['vlan'] == 'native' %}
170             {%- if ovs_dpdk_bridge == 'br-phy' and role == 'compute' %}
171             -
172               type: ovs_user_bridge
173               name: {{ ovs_dpdk_bridge }}
174               use_dhcp: false
175               addresses:
176                 -
177                   ip_netmask: {get_param: TenantIpSubnet}
178               members:
179                 -
180                   type: ovs_dpdk_port
181                   name: dpdk0
182                   driver: {{ nets['tenant']['nic_mapping'][role]['uio_driver'] }}
183                   members:
184                     -
185                       type: interface
186                       name: {{ nets['tenant']['nic_mapping'][role]['members'][0] }}
187                       # force the MAC address of the bridge to this interface
188                       primary: true
189             {%- else %}
190             -
191               type: {{ nets['tenant']['nic_mapping'][role]['phys_type'] }}
192               name: {{ nets['tenant']['nic_mapping'][role]['members'][0] }}
193               {%- if 'uio-driver' in nets['tenant']['nic_mapping'][role] %}
194               uio_driver: {{ nets['tenant']['nic_mapping'][role]['uio-driver'] }}
195               {%- endif %}
196               {%- if 'interface-options' in nets['tenant']['nic_mapping'][role] %}
197               options: '{{ nets['tenant']['nic_mapping'][role]['interface-options'] }}'
198               {%- endif %}
199               use_dhcp: false
200               addresses:
201                 -
202                   ip_netmask: {get_param: TenantIpSubnet}
203             {%- endif %}
204             {%- endif %}
205             {%- if nets['external'][0]['enabled'] and external_net_type != 'br-ex' and nets['external'][0]['nic_mapping'][role]['vlan'] == 'native' %}
206             -
207               type: {{ nets['external'][0]['nic_mapping'][role]['phys_type'] }}
208               name: {{ nets['external'][0]['nic_mapping'][role]['members'][0] }}
209               {%- if 'uio-driver' in nets['external'][0]['nic_mapping'][role] %}
210               uio_driver: {{ nets['external'][0]['nic_mapping'][role]['uio-driver'] }}
211               {%- endif %}
212               {%- if role == 'controller' %}
213               dns_servers: {get_param: DnsServers}
214               {%- endif %}
215               use_dhcp: false
216               addresses:
217                 -
218                   ip_netmask: {get_param: ExternalIpSubnet}
219               routes:
220                 -
221                   {%- if role == 'controller' %}
222                   default: true
223                   {%- endif %}
224                   ip_netmask: 0.0.0.0/0
225                   next_hop: {get_param: ExternalInterfaceDefaultRoute}
226             {%- elif nets['external'][0]['enabled'] and external_net_type == 'br-ex' and nets['external'][0]['nic_mapping'][role]['vlan'] == 'native' %}
227             -
228               {%- if ovs_dpdk_bridge == 'br-phy' and role == 'compute' %}
229               type: ovs_user_bridge
230               {%- else %}
231               type: ovs_bridge
232               {%- endif %}
233               name: {get_input: bridge_name}
234               use_dhcp: false
235               members:
236                 -
237                   type: interface
238                   name: {{ nets['external'][0]['nic_mapping'][role]['members'][0] }}
239                   # force the MAC address of the bridge to this interface
240                   primary: true
241               {%- if role == 'controller' %}
242               dns_servers: {get_param: DnsServers}
243               addresses:
244                 -
245                   ip_netmask: {get_param: ExternalIpSubnet}
246               routes:
247                 -
248                   default: true
249                   ip_netmask: 0.0.0.0/0
250                   next_hop: {get_param: ExternalInterfaceDefaultRoute}
251               {%- endif %}
252             {%- endif %}
253             {%- if nets['storage']['enabled'] and nets['storage']['nic_mapping'][role]['vlan'] == 'native' %}
254             -
255               type: interface
256               name: {{ nets['storage']['nic_mapping'][role]['members'][0] }}
257               use_dhcp: false
258               addresses:
259                 -
260                   ip_netmask: {get_param: StorageIpSubnet}
261             {%- endif %}
262             {%- if nets['api']['enabled'] and nets['api']['nic_mapping'][role]['vlan'] == 'native' %}
263             -
264               type: interface
265               name: {{ nets['api']['nic_mapping'][role]['members'][0] }}
266               use_dhcp: false
267               addresses:
268                 -
269                   ip_netmask: {get_param: InternalApiIpSubnet}
270             {%- endif %}
271
272 outputs:
273   OS::stack_id:
274     description: The OsNetConfigImpl resource.
275     value: {get_resource: OsNetConfigImpl}