Fixes incompatible python-docker package
[apex.git] / build / nics-template.yaml.jinja2
1 heat_template_version: 2016-10-14
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   ControlPlaneStaticRoutes:
13     default: []
14     description: >
15       Routes for the ctlplane network traffic.
16       JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
17       Unless the default is changed, the parameter is automatically resolved
18       from the subnet host_routes attribute.
19     type: json
20   ExternalNetworkVlanID:
21     default: 10
22     description: Vlan ID for the external network traffic.
23     type: number
24   InternalApiNetworkVlanID:
25     default: 20
26     description: Vlan ID for the internal_api network traffic.
27     type: number
28   StorageNetworkVlanID:
29     default: 30
30     description: Vlan ID for the storage network traffic.
31     type: number
32   StorageMgmtNetworkVlanID:
33     default: 40
34     description: Vlan ID for the storage mgmt network traffic.
35     type: number
36   TenantNetworkVlanID:
37     default: 50
38     description: Vlan ID for the tenant network traffic.
39     type: number
40   ManagementNetworkVlanID:
41     default: 60
42     description: Vlan ID for the management network traffic.
43     type: number
44   ExternalInterfaceDefaultRoute:
45     default: '10.0.0.1'
46     description: default route for the external network
47     type: string
48   ControlPlaneSubnetCidr: # Override this via parameter_defaults
49     default: '24'
50     description: The subnet CIDR of the control plane network.
51     type: string
52   ControlPlaneDefaultRoute: # Override this via parameter_defaults
53     description: The default route of the control plane network.
54     type: string
55   DnsServers: # Override this via parameter_defaults
56     default: []
57     description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
58     type: comma_delimited_list
59   EC2MetadataIp: # Override this via parameter_defaults
60     description: The IP address of the EC2 metadata server.
61     type: string
62   ExternalIpSubnet:
63     default: ''
64     description: IP address/subnet on the external network
65     type: string
66   ExternalInterfaceRoutes:
67     default: []
68     description: >
69       Routes for the external network traffic.
70       JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
71       Unless the default is changed, the parameter is automatically resolved
72       from the subnet host_routes attribute.
73     type: json
74   InternalApiIpSubnet:
75     default: ''
76     description: IP address/subnet on the internal_api network
77     type: string
78   InternalApiInterfaceRoutes:
79     default: []
80     description: >
81       Routes for the internal_api network traffic.
82       JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
83       Unless the default is changed, the parameter is automatically resolved
84       from the subnet host_routes attribute.
85     type: json
86   StorageIpSubnet:
87     default: ''
88     description: IP address/subnet on the storage network
89     type: string
90   StorageInterfaceRoutes:
91     default: []
92     description: >
93       Routes for the storage network traffic.
94       JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
95       Unless the default is changed, the parameter is automatically resolved
96       from the subnet host_routes attribute.
97     type: json
98   StorageMgmtIpSubnet:
99     default: ''
100     description: IP address/subnet on the storage_mgmt network
101     type: string
102   StorageMgmtInterfaceRoutes:
103     default: []
104     description: >
105       Routes for the storage_mgmt network traffic.
106       JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
107       Unless the default is changed, the parameter is automatically resolved
108       from the subnet host_routes attribute.
109     type: json
110   StorageNFSIpSubnet:
111     default: ''
112     description: IP address/subnet on the storage_nfs network
113     type: string
114   StorageNFSRoutes:
115     default: []
116     description: >
117       Routes for the storage_nfs network traffic.
118       JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
119       Unless the default is changed, the parameter is automatically resolved
120       from the subnet host_routes attribute.
121     type: json
122   TenantIpSubnet:
123     default: ''
124     description: IP address/subnet on the tenant network
125     type: string
126   TenantInterfaceRoutes:
127     default: []
128     description: >
129       Routes for the tenant network traffic.
130       JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
131       Unless the default is changed, the parameter is automatically resolved
132       from the subnet host_routes attribute.
133     type: json
134   ManagementIpSubnet:
135     default: ''
136     description: IP address/subnet on the management network
137     type: string
138   ManagementInterfaceRoutes:
139     default: []
140     description: >
141       Routes for the management network traffic.
142       JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
143       Unless the default is changed, the parameter is automatically resolved
144       from the subnet host_routes attribute.
145     type: json
146
147 resources:
148   OsNetConfigImpl:
149     type: OS::Heat::SoftwareConfig
150     properties:
151       group: script
152       config:
153         str_replace:
154           template:
155             get_file: /usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh
156           params:
157             $network_config:
158               network_config:
159               -
160               {%- 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 %}
161                 type: ovs_bridge
162               {%- if nets['external'][0]['enabled'] and nets['external'][0]['nic_mapping'][role]['vlan'] == 'native' %}
163                 name: br-isolated
164               {%- else %}
165                 name: br-ex
166               {%- endif %}
167                 members:
168                   -
169                     type: interface
170                     name: {{ nets['admin']['nic_mapping'][role]['members'][0] }}
171                     # force the MAC address of the bridge to this interface
172                     primary: true
173                   {%- if nets['external'][0]['enabled'] and nets['external'][0]['nic_mapping'][role]['vlan'] is number %}
174                   -
175                     type: vlan
176                     vlan_id: {get_param: ExternalNetworkVlanID}
177                     addresses:
178                     -
179                       ip_netmask: {get_param: ExternalIpSubnet}
180                     routes:
181                       -
182                         default: true
183                         next_hop: {get_param: ExternalInterfaceDefaultRoute}
184                   {%- endif %}
185                   {%- if nets['tenant']['enabled'] and nets['tenant']['nic_mapping'][role]['vlan'] is number %}
186                   -
187                     type: vlan
188                     vlan_id: {get_param: TenantNetworkVlanID}
189                     addresses:
190                       -
191                         ip_netmask: {get_param: TenantIpSubnet}
192                   {%- endif %}
193                   {%- if nets['storage']['enabled'] and nets['storage']['nic_mapping'][role]['vlan'] is number %}
194                   -
195                     type: vlan
196                     vlan_id: {get_param: StorageNetworkVlanID}
197                     addresses:
198                       -
199                         ip_netmask: {get_param: StorageIpSubnet}
200                   {%- endif %}
201                   {%- if nets['api']['enabled'] and nets['api']['nic_mapping'][role]['vlan'] is number %}
202                   -
203                     type: vlan
204                     vlan_id: {get_param: InternalApiNetworkVlanID}
205                     addresses:
206                       -
207                         ip_netmask: {get_param: InternalApiIpSubnet}
208                   {%- endif %}
209               {%- else %}
210                 type: {{ nets['admin']['nic_mapping'][role]['phys_type'] }}
211                 {%- if nets['admin']['nic_mapping'][role]['phys_type'] == 'linux_bridge' %}
212                 name: br-ctlplane
213                 members:
214                   -
215                     type: interface
216                     name: {{ nets['admin']['nic_mapping'][role]['members'][0] }}
217                     primary: true
218                 {%- else %}
219                 name: {{ nets['admin']['nic_mapping'][role]['members'][0] }}
220                 {%- endif %}
221               {%- endif %}
222                 use_dhcp: false
223                 dns_servers: {get_param: DnsServers}
224                 addresses:
225                   -
226                     ip_netmask:
227                       list_join:
228                         - '/'
229                         - - {get_param: ControlPlaneIp}
230                           - {get_param: ControlPlaneSubnetCidr}
231                 routes:
232                   -
233                     ip_netmask: 169.254.169.254/32
234                     next_hop: {get_param: EC2MetadataIp}
235                   {%- if external_net_af == 6 or role == 'compute' or not nets['external'][0]['enabled'] %}
236                   -
237                     default: true
238                     next_hop: {get_param: ControlPlaneDefaultRoute}
239                   {%- endif %}
240
241               {%- if nets['tenant']['enabled'] and nets['tenant']['nic_mapping'][role]['vlan'] == 'native' %}
242               {%- if ovs_dpdk_bridge == 'br-phy' and role == 'compute' %}
243               -
244                 type: ovs_user_bridge
245                 name: {{ ovs_dpdk_bridge }}
246                 use_dhcp: false
247                 addresses:
248                   -
249                     ip_netmask: {get_param: TenantIpSubnet}
250                 members:
251                   -
252                     type: ovs_dpdk_port
253                     name: dpdk0
254                     driver: {{ nets['tenant']['nic_mapping'][role]['uio_driver'] }}
255                     members:
256                       -
257                         type: interface
258                         name: {{ nets['tenant']['nic_mapping'][role]['members'][0] }}
259                         # force the MAC address of the bridge to this interface
260                         primary: true
261               {%- elif nets['tenant']['segmentation_type'] == 'vlan' %}
262                 type: ovs_bridge
263                 name: br-vlan
264                 use_dhcp: false
265                 addresses:
266                   -
267                     ip_netmask: {get_param: TenantIpSubnet}
268                 members:
269                   -
270                     type: interface
271                     name: {{ nets['tenant']['nic_mapping'][role]['members'][0] }}
272                     primary: true
273               {%- else %}
274               -
275                 type: {{ nets['tenant']['nic_mapping'][role]['phys_type'] }}
276                 name: {{ nets['tenant']['nic_mapping'][role]['members'][0] }}
277                 {%- if 'uio-driver' in nets['tenant']['nic_mapping'][role] %}
278                 uio_driver: {{ nets['tenant']['nic_mapping'][role]['uio-driver'] }}
279                 {%- endif %}
280                 {%- if 'interface-options' in nets['tenant']['nic_mapping'][role] %}
281                 options: '{{ nets['tenant']['nic_mapping'][role]['interface-options'] }}'
282                 {%- endif %}
283                 use_dhcp: false
284                 addresses:
285                   -
286                     ip_netmask: {get_param: TenantIpSubnet}
287               {%- endif %}
288               {%- endif %}
289               {%- if nets['external'][0]['enabled'] and external_net_type != 'br-ex' and nets['external'][0]['nic_mapping'][role]['vlan'] == 'native' %}
290               -
291                 type: {{ nets['external'][0]['nic_mapping'][role]['phys_type'] }}
292                 name: {{ nets['external'][0]['nic_mapping'][role]['members'][0] }}
293                 {%- if 'uio-driver' in nets['external'][0]['nic_mapping'][role] %}
294                 uio_driver: {{ nets['external'][0]['nic_mapping'][role]['uio-driver'] }}
295                 {%- endif %}
296                 {%- if role == 'controller' %}
297                 dns_servers: {get_param: DnsServers}
298                 {%- endif %}
299                 use_dhcp: false
300                 addresses:
301                   -
302                     ip_netmask: {get_param: ExternalIpSubnet}
303                 routes:
304                   -
305                     {%- if role == 'controller' %}
306                     default: true
307                     {%- endif %}
308                     ip_netmask: 0.0.0.0/0
309                     next_hop: {get_param: ExternalInterfaceDefaultRoute}
310               {%- elif nets['external'][0]['enabled'] and external_net_type == 'br-ex' and nets['external'][0]['nic_mapping'][role]['vlan'] == 'native' %}
311               -
312                 {%- if ovs_dpdk_bridge == 'br-phy' and role == 'compute' %}
313                 type: ovs_user_bridge
314                 {%- else %}
315                 type: {{ nets['external'][0]['nic_mapping'][role]['phys_type'] }}
316                 {%- endif %}
317                 name: br-ex
318                 use_dhcp: false
319                 members:
320                   -
321                     type: interface
322                     name: {{ nets['external'][0]['nic_mapping'][role]['members'][0] }}
323                     # force the MAC address of the bridge to this interface
324                     primary: true
325                 dns_servers: {get_param: DnsServers}
326                 addresses:
327                   -
328                     ip_netmask: {get_param: ExternalIpSubnet}
329                 routes:
330                   -
331                     default: true
332                     ip_netmask: 0.0.0.0/0
333                     next_hop: {get_param: ExternalInterfaceDefaultRoute}
334               {%- endif %}
335               {%- if nets['storage']['enabled'] and nets['storage']['nic_mapping'][role]['vlan'] == 'native' %}
336               -
337                 type: interface
338                 name: {{ nets['storage']['nic_mapping'][role]['members'][0] }}
339                 use_dhcp: false
340                 addresses:
341                   -
342                     ip_netmask: {get_param: StorageIpSubnet}
343               {%- endif %}
344               {%- if nets['api']['enabled'] and nets['api']['nic_mapping'][role]['vlan'] == 'native' %}
345               -
346                 type: interface
347                 name: {{ nets['api']['nic_mapping'][role]['members'][0] }}
348                 use_dhcp: false
349                 addresses:
350                   -
351                     ip_netmask: {get_param: InternalApiIpSubnet}
352               {%- endif %}
353
354 outputs:
355   OS::stack_id:
356     description: The OsNetConfigImpl resource.
357     value: {get_resource: OsNetConfigImpl}