Add ports to ovs bridge config
[fuel.git] / mcp / reclass / classes / cluster / mcp-pike-common-ha / openstack_compute_pdf.yml.j2
1 ##############################################################################
2 # Copyright (c) 2018 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 {%- import 'net_map.j2' as nm with context %}
10 {#- Filter-out NIC duplicates by constructing a dict (used NICs only) #}
11 {%- set nics = { nm.cmp001.nic_admin: True, nm.cmp001.nic_mgmt: True } %}
12 {%- set vlans = { nm.vlan_admin: nm.cmp001.nic_admin, nm.vlan_mgmt: nm.cmp001.nic_mgmt } %}
13 ---
14 {%- if not conf.nodes[nm.cmp001.idx].node.type == 'virtual' %}
15 classes:
16   - system.nova.compute.nfv.cpu_pinning
17 {%- endif %}
18 parameters:
19   _param:
20     # Should later be determined via PDF/IDF, AArch64 has ESP on /dev/sda1
21 {%- if conf.nodes[nm.cmp001.idx].node.type == 'virtual' %}
22     ~cinder_lvm_devices: ['/dev/vdb']
23 {%- elif conf.nodes[nm.cmp001.idx].node.arch == 'aarch64' or
24          conf.nodes[nm.cmp001.idx].disks.0.disk_capacity | storage_size_num | float > 2000000000000 %}
25     ~cinder_lvm_devices: ['/dev/sda2']
26 {%- else %}
27     ~cinder_lvm_devices: ['/dev/sda1']
28 {%- endif %}
29   linux:
30     network:
31       bridge: openvswitch
32       interface:
33 {%- for nic in nics %}
34     {%- if nic == nm.cmp001.nic_admin %}
35         {{ nic }}:
36           enabled: true
37           type: eth
38           proto: dhcp
39           name: {{ nic }}
40     {%- else %}
41         {{ nic }}:
42           enabled: true
43           type: eth
44           proto: manual
45           address: 0.0.0.0
46           {%- if nic == nm.cmp001.nic_public %}
47           netmask: ${_param:opnfv_net_public_mask}
48           {%- else %}
49           netmask: 255.255.255.0
50           {%- endif %}
51           mtu: ${_param:interface_mtu}
52           name: {{ nic }}
53     {%- endif %}
54 {%- endfor %}
55
56 {%- for vlan in vlans %}
57     {%- if vlan | int > 0 %}
58         {{ vlans[vlan] }}.{{ vlan }}:
59           enabled: true
60           proto: manual
61           type: vlan
62           name: {{ vlans[vlan] }}.{{ vlan }}
63           use_interfaces:
64             - {{ vlans[vlan] }}
65     {%- endif %}
66 {%- endfor %}
67
68         br-ctl:
69           enabled: true
70           type: bridge
71           proto: static
72           address: ${_param:single_address}
73           netmask: 255.255.255.0
74           use_interfaces:
75             - {{ nm.cmp001.nic_mgmt }}{% if nm.vlan_mgmt | int > 0 %}.{{ nm.vlan_mgmt }}{% endif %}
76         br-floating:
77           enabled: true
78           type: ovs_bridge
79           mtu: ${_param:interface_mtu}
80           proto: static
81           address: ${_param:external_address}
82           netmask: ${_param:opnfv_net_public_mask}
83           use_interfaces:
84             - {{ nm.cmp001.nic_public }}{% if nm.vlan_public | int > 0 %}.{{ nm.vlan_public }}{% endif %}
85           route:
86             public:
87               address: 0.0.0.0
88               netmask: 0.0.0.0
89               gateway: ${_param:opnfv_net_public_gw}
90         ovs_port_{{ nm.cmp001.nic_public }}:
91           enabled: true
92           name: {{ nm.cmp001.nic_public }}{% if nm.vlan_public | int > 0 %}.{{ nm.vlan_public }}{% endif %}
93           proto: manual
94           ovs_port_type: OVSPort
95           type: ovs_port
96           ovs_bridge: br-floating
97           bridge: br-floating