[baremetal] Fix openstack_compute_pdf yaml err
[fuel.git] / mcp / reclass / classes / cluster / baremetal-mcp-pike-common-ha / openstack_compute_pdf.yml.j2
1 ##############################################################################
2 # Copyright (c) 2017 Mirantis Inc., Enea AB and others.
3 # All rights reserved. This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
6 # http://www.apache.org/licenses/LICENSE-2.0
7 ##############################################################################
8 {# NOTE: br-{mgmt,ctl} are cross-referenced, careful when changing names #}
9 {%- if conf.idf is defined and conf.idf.net_config is defined -%}
10     {#- NOTE: Currently, we assume all cluster nodes use the same mapping -#}
11
12     {#- Determine interface index for each network (plumbing vars) -#}
13     {%- set idx_admin = conf['idf']['net_config']['admin']['interface'] -%}
14     {%- set idx_mgmt = conf['idf']['net_config']['mgmt']['interface'] -%}
15     {%- set idx_private = conf['idf']['net_config']['private']['interface'] -%}
16     {%- set idx_public = conf['idf']['net_config']['public']['interface'] -%}
17
18     {#- Physical interface OS name for each network (e.g. em1, enp1s0f1) -#}
19     {%- set iface_names = conf['idf']['fuel']['network']['node'][3]['interfaces'] -%}
20     {%- set nic_admin = iface_names[idx_admin] -%}
21     {%- set nic_mgmt = iface_names[idx_mgmt] -%}
22     {%- set nic_private = iface_names[idx_private] -%}
23     {%- set nic_public = iface_names[idx_public] -%}
24
25     {#- VLAN for each network (only untagged 'admin' is supported by MaaS config!) -#}
26     {%- set vlan_admin = conf['idf']['net_config']['admin']['vlan'] -%}
27     {%- set vlan_mgmt = conf['idf']['net_config']['mgmt']['vlan'] -%}
28     {%- set vlan_private = conf['idf']['net_config']['private']['vlan'] -%}
29     {%- set vlan_public = conf['idf']['net_config']['public']['vlan'] -%}
30 {%- else -%}
31     {%- set nic_admin = 'enp6s0' -%}
32     {%- set nic_mgmt = 'enp6s0' -%}
33     {%- set nic_private = None -%}
34     {%- set nic_public = None -%}
35     {%- set vlan_admin = 'native' -%}
36     {%- set vlan_mgmt = '300' -%}
37     {%- set vlan_private = '1000' -%}
38 {%- endif -%}
39
40 {#- Filter-out NIC duplicates by constructing a dict (used NICs only) -#}
41 {%- set nics = { nic_admin: True, nic_mgmt: True } -%}
42
43 {%- set vlans = { vlan_admin: nic_admin, vlan_mgmt: nic_mgmt } -%}
44 ---
45 parameters:
46   linux:
47     network:
48       bridge: openvswitch
49       interface:
50 {%- for nic in nics %}
51     {%- if nic == nic_admin %}
52         {{ nic }}:
53           enabled: true
54           type: eth
55           proto: dhcp
56           name: {{ nic }}
57     {%- else %}
58         {{ nic }}:
59           enabled: true
60           type: eth
61           proto: manual
62           address: 0.0.0.0
63           {%- if nic == nic_public %}
64           netmask: ${_param:opnfv_net_public_mask}
65           {%- else %}
66           netmask: 255.255.255.0
67           {%- endif %}
68           mtu: ${_param:interface_mtu}
69           name: {{ nic }}
70     {%- endif %}
71 {%- endfor %}
72
73 {%- for vlan in vlans %}
74     {%- if vlan and vlan != 'native' %}
75         {{ vlans[vlan] }}.{{ vlan }}:
76           enabled: true
77           proto: manual
78           type: vlan
79           name: {{ vlans[vlan] }}.{{ vlan }}
80           use_interfaces:
81             - {{ vlans[vlan] }}
82     {%- endif %}
83 {%- endfor %}
84
85         br-ctl:
86           enabled: true
87           type: bridge
88           proto: static
89           address: ${_param:single_address}
90           netmask: 255.255.255.0
91           use_interfaces:
92             - {{ nic_mgmt }}{% if vlan_mgmt and vlan_mgmt != 'native' %}.{{ vlan_mgmt }}{% endif %}
93         br-floating:
94           enabled: true
95           type: ovs_bridge
96           mtu: ${_param:interface_mtu}
97         br-ex:
98           enabled: true
99           type: ovs_port
100           bridge: br-floating
101           proto: static
102           {%- if vlan_public and vlan_public != 'native' %}
103           ovs_options: tag={{ vlan_public }}
104           {%- endif %}
105           address: ${_param:external_address}
106           netmask: 255.255.255.0
107           route:
108             public:
109               address: 0.0.0.0
110               netmask: 0.0.0.0
111               gateway: ${_param:opnfv_net_public_gw}
112         {{ nic_public }}:
113           enabled: true
114           proto: manual
115           ovs_port_type: OVSPort
116           type: ovs_port
117           ovs_bridge: br-floating
118           bridge: br-floating