Merge "[noha] Parameterize network configuration"
[fuel.git] / mcp / reclass / classes / cluster / mcp-common-noha / 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 {%- import 'net_macros.j2' as ma with context %}
11 {#- Filter-out NIC duplicates by constructing a dict (used NICs only) #}
12 {%- set nics = { nm.cmp001.nic_mgmt: True, nm.cmp001.nic_private: True } %}
13 {%- set vlan_private_start = (nm.vlan_private | string).rsplit('-')[0] %}
14 {%- set vlans = { nm.vlan_mgmt: nm.cmp001.nic_mgmt, vlan_private_start: nm.cmp001.nic_private } %}
15 ---
16 parameters:
17   _param:
18     # Should later be determined via PDF/IDF, AArch64 has ESP on /dev/sda1
19 {%- if conf.nodes[nm.cmp001.idx].node.type == 'virtual' %}
20     ~cinder_lvm_devices: ['/dev/vdb']
21 {%- elif conf.nodes[nm.cmp001.idx].node.arch == 'aarch64' or
22          conf.nodes[nm.cmp001.idx].disks.0.disk_capacity | storage_size_num | float > 2000000000000 %}
23     ~cinder_lvm_devices: ['/dev/sda2']
24 {%- else %}
25     ~cinder_lvm_devices: ['/dev/sda1']
26 {%- endif %}
27   linux:
28     network:
29       bridge: openvswitch
30       interface:
31         pxe_admin_int:
32           enabled: true
33           name: {{ nm.cmp001.nic_admin }}
34           proto: static
35           type: eth
36           address: ${_param:pxe_admin_address}
37           netmask: ${_param:opnfv_net_admin_mask}
38           mtu: ${_param:interface_mtu}
39           noifupdown: true
40
41 {#- prevent duplicates for tagged mgmt on the same physical interface as PXE/admin #}
42 {%- if nm.cmp001.nic_admin in nics %}
43   {%- do nics.pop(nm.cmp001.nic_admin) %}
44 {%- endif %}
45
46 {{ ma.linux_network_interfaces_nic(nics) }}
47
48 {{ ma.linux_network_interfaces_vlan(vlans) }}
49
50         br-mgmt:
51           enabled: true
52           type: bridge
53           proto: static
54           address: ${_param:single_address}
55           netmask: ${_param:opnfv_net_mgmt_mask}
56           use_interfaces:
57             - {{ ma.interface_str(nm.cmp001.nic_mgmt, nm.vlan_mgmt) }}