From f6cae340635775ecd339a08e78ef583ecca092ec Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sat, 1 Sep 2018 23:49:08 +0200 Subject: [PATCH] [scenario] Factor out common nodes, states Make the bulk of scenario files static again by shifting out all common virtual nodes (mas01) and states (virtual_init, maas etc.) to default.yaml(.j2). This allows us to parse scenario-specific data during first j2 expansion, preparing for the new Pharos installer adapter that relies on `conf.virtual.nodes.control` length to construct the proper list of MaaS node definitions (kvm{01,02,03} vs {ctl01,gtw01}). Change-Id: I666ab5bd6bb2a42f98646af51950f6b9fffa0e8b Signed-off-by: Alexandru Avadanii --- mcp/config/scenario/.gitignore | 2 +- .../scenario/{defaults.yaml => defaults.yaml.j2} | 19 +++++++++++++++++++ ...ofeature-ha.yaml.j2 => os-nosdn-nofeature-ha.yaml} | 13 ------------- ...ture-noha.yaml.j2 => os-nosdn-nofeature-noha.yaml} | 10 ---------- .../{os-nosdn-ovs-ha.yaml.j2 => os-nosdn-ovs-ha.yaml} | 13 ------------- ...-nosdn-ovs-noha.yaml.j2 => os-nosdn-ovs-noha.yaml} | 10 ---------- .../{os-nosdn-vpp-ha.yaml.j2 => os-nosdn-vpp-ha.yaml} | 13 ------------- ...-nosdn-vpp-noha.yaml.j2 => os-nosdn-vpp-noha.yaml} | 10 ---------- ...-nofeature-ha.yaml.j2 => os-odl-nofeature-ha.yaml} | 13 ------------- ...eature-noha.yaml.j2 => os-odl-nofeature-noha.yaml} | 10 ---------- .../{os-odl-ovs-noha.yaml.j2 => os-odl-ovs-noha.yaml} | 10 ---------- ...-nofeature-ha.yaml.j2 => os-ovn-nofeature-ha.yaml} | 13 ------------- ...eature-noha.yaml.j2 => os-ovn-nofeature-noha.yaml} | 10 ---------- mcp/scripts/xdf_data.sh.j2 | 3 ++- 14 files changed, 22 insertions(+), 127 deletions(-) rename mcp/config/scenario/{defaults.yaml => defaults.yaml.j2} (78%) rename mcp/config/scenario/{os-nosdn-nofeature-ha.yaml.j2 => os-nosdn-nofeature-ha.yaml} (77%) rename mcp/config/scenario/{os-nosdn-nofeature-noha.yaml.j2 => os-nosdn-nofeature-noha.yaml} (76%) rename mcp/config/scenario/{os-nosdn-ovs-ha.yaml.j2 => os-nosdn-ovs-ha.yaml} (77%) rename mcp/config/scenario/{os-nosdn-ovs-noha.yaml.j2 => os-nosdn-ovs-noha.yaml} (78%) rename mcp/config/scenario/{os-nosdn-vpp-ha.yaml.j2 => os-nosdn-vpp-ha.yaml} (78%) rename mcp/config/scenario/{os-nosdn-vpp-noha.yaml.j2 => os-nosdn-vpp-noha.yaml} (76%) rename mcp/config/scenario/{os-odl-nofeature-ha.yaml.j2 => os-odl-nofeature-ha.yaml} (77%) rename mcp/config/scenario/{os-odl-nofeature-noha.yaml.j2 => os-odl-nofeature-noha.yaml} (77%) rename mcp/config/scenario/{os-odl-ovs-noha.yaml.j2 => os-odl-ovs-noha.yaml} (79%) rename mcp/config/scenario/{os-ovn-nofeature-ha.yaml.j2 => os-ovn-nofeature-ha.yaml} (77%) rename mcp/config/scenario/{os-ovn-nofeature-noha.yaml.j2 => os-ovn-nofeature-noha.yaml} (76%) diff --git a/mcp/config/scenario/.gitignore b/mcp/config/scenario/.gitignore index a2d43db14..13346b908 100644 --- a/mcp/config/scenario/.gitignore +++ b/mcp/config/scenario/.gitignore @@ -1 +1 @@ -*ha.yaml +defaults.yaml diff --git a/mcp/config/scenario/defaults.yaml b/mcp/config/scenario/defaults.yaml.j2 similarity index 78% rename from mcp/config/scenario/defaults.yaml rename to mcp/config/scenario/defaults.yaml.j2 index db98eb169..141af4d26 100644 --- a/mcp/config/scenario/defaults.yaml +++ b/mcp/config/scenario/defaults.yaml.j2 @@ -5,12 +5,29 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +{%- import 'net_map.j2' as nm with context %} --- x86_64: base_image: https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img default: vcpus: 2 ram: 4096 + virtual: &arch_default_virtual_nodes_infra + nodes: + infra: +{%- if nm.cluster.has_baremetal_nodes %} + - mas01 +{%- endif %} + cluster: &arch_default_cluster_states + states: + - virtual_init +{%- if nm.cluster.has_baremetal_nodes %} + - maas + - baremetal_init +{%- if conf.MCP_VCP %} + - virtual_control_plane +{%- endif %} +{%- endif %} common: apt: keys: @@ -32,6 +49,8 @@ aarch64: default: vcpus: 6 ram: 4096 + virtual: *arch_default_virtual_nodes_infra + cluster: *arch_default_cluster_states common: apt: keys: diff --git a/mcp/config/scenario/os-nosdn-nofeature-ha.yaml.j2 b/mcp/config/scenario/os-nosdn-nofeature-ha.yaml similarity index 77% rename from mcp/config/scenario/os-nosdn-nofeature-ha.yaml.j2 rename to mcp/config/scenario/os-nosdn-nofeature-ha.yaml index 55da8f74b..ce79b838e 100644 --- a/mcp/config/scenario/os-nosdn-nofeature-ha.yaml.j2 +++ b/mcp/config/scenario/os-nosdn-nofeature-ha.yaml @@ -5,27 +5,14 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -{%- import 'net_map.j2' as nm with context %} --- cluster: domain: mcp-ovs-ha.local states: - - virtual_init -{%- if nm.cluster.has_baremetal_nodes %} - - maas - - baremetal_init -{%- endif %} -{%- if conf.MCP_VCP %} - - virtual_control_plane -{%- endif %} - openstack_ha - networks virtual: nodes: - infra: -{%- if nm.cluster.has_baremetal_nodes %} - - mas01 -{%- endif %} control: - kvm01 - kvm02 diff --git a/mcp/config/scenario/os-nosdn-nofeature-noha.yaml.j2 b/mcp/config/scenario/os-nosdn-nofeature-noha.yaml similarity index 76% rename from mcp/config/scenario/os-nosdn-nofeature-noha.yaml.j2 rename to mcp/config/scenario/os-nosdn-nofeature-noha.yaml index cd214a5cd..179313bc1 100644 --- a/mcp/config/scenario/os-nosdn-nofeature-noha.yaml.j2 +++ b/mcp/config/scenario/os-nosdn-nofeature-noha.yaml @@ -5,25 +5,15 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -{%- import 'net_map.j2' as nm with context %} --- cluster: domain: mcp-ovs-noha.local states: - - virtual_init -{%- if nm.cluster.has_baremetal_nodes %} - - maas - - baremetal_init -{%- endif %} - openstack_noha - neutron_gateway - networks virtual: nodes: - infra: -{%- if nm.cluster.has_baremetal_nodes %} - - mas01 -{%- endif %} control: - ctl01 - gtw01 diff --git a/mcp/config/scenario/os-nosdn-ovs-ha.yaml.j2 b/mcp/config/scenario/os-nosdn-ovs-ha.yaml similarity index 77% rename from mcp/config/scenario/os-nosdn-ovs-ha.yaml.j2 rename to mcp/config/scenario/os-nosdn-ovs-ha.yaml index 0f7a7bc34..57f2140bb 100644 --- a/mcp/config/scenario/os-nosdn-ovs-ha.yaml.j2 +++ b/mcp/config/scenario/os-nosdn-ovs-ha.yaml @@ -5,28 +5,15 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -{%- import 'net_map.j2' as nm with context %} --- cluster: domain: mcp-ovs-dpdk-ha.local states: - - virtual_init -{%- if nm.cluster.has_baremetal_nodes %} - - maas - - baremetal_init -{%- endif %} -{%- if conf.MCP_VCP %} - - virtual_control_plane -{%- endif %} - dpdk - openstack_ha - networks virtual: nodes: - infra: -{%- if nm.cluster.has_baremetal_nodes %} - - mas01 -{%- endif %} control: - kvm01 - kvm02 diff --git a/mcp/config/scenario/os-nosdn-ovs-noha.yaml.j2 b/mcp/config/scenario/os-nosdn-ovs-noha.yaml similarity index 78% rename from mcp/config/scenario/os-nosdn-ovs-noha.yaml.j2 rename to mcp/config/scenario/os-nosdn-ovs-noha.yaml index bf37f93ea..15cad1d29 100644 --- a/mcp/config/scenario/os-nosdn-ovs-noha.yaml.j2 +++ b/mcp/config/scenario/os-nosdn-ovs-noha.yaml @@ -5,26 +5,16 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -{%- import 'net_map.j2' as nm with context %} --- cluster: domain: mcp-ovs-dpdk-noha.local states: - - virtual_init -{%- if nm.cluster.has_baremetal_nodes %} - - maas - - baremetal_init -{%- endif %} - dpdk - openstack_noha - neutron_gateway - networks virtual: nodes: - infra: -{%- if nm.cluster.has_baremetal_nodes %} - - mas01 -{%- endif %} control: - ctl01 - gtw01 diff --git a/mcp/config/scenario/os-nosdn-vpp-ha.yaml.j2 b/mcp/config/scenario/os-nosdn-vpp-ha.yaml similarity index 78% rename from mcp/config/scenario/os-nosdn-vpp-ha.yaml.j2 rename to mcp/config/scenario/os-nosdn-vpp-ha.yaml index 6ccb59061..9e7ebc1e2 100644 --- a/mcp/config/scenario/os-nosdn-vpp-ha.yaml.j2 +++ b/mcp/config/scenario/os-nosdn-vpp-ha.yaml @@ -5,27 +5,14 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -{%- import 'net_map.j2' as nm with context %} --- cluster: domain: mcp-vpp-ha.local states: -{%- if nm.cluster.has_baremetal_nodes %} - - maas - - baremetal_init -{%- endif %} -{%- if conf.MCP_VCP %} - - virtual_control_plane -{%- endif %} - openstack_ha - networks virtual: nodes: - infra: - - cfg01 -{%- if nm.cluster.has_baremetal_nodes %} - - mas01 -{%- endif %} control: - kvm01 - kvm02 diff --git a/mcp/config/scenario/os-nosdn-vpp-noha.yaml.j2 b/mcp/config/scenario/os-nosdn-vpp-noha.yaml similarity index 76% rename from mcp/config/scenario/os-nosdn-vpp-noha.yaml.j2 rename to mcp/config/scenario/os-nosdn-vpp-noha.yaml index 41cb504e1..e90300407 100644 --- a/mcp/config/scenario/os-nosdn-vpp-noha.yaml.j2 +++ b/mcp/config/scenario/os-nosdn-vpp-noha.yaml @@ -5,25 +5,15 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -{%- import 'net_map.j2' as nm with context %} --- cluster: domain: mcp-vpp-noha.local states: -{%- if nm.cluster.has_baremetal_nodes %} - - maas - - baremetal_init -{%- endif %} - openstack_noha - neutron_gateway - networks virtual: nodes: - infra: - - cfg01 -{%- if nm.cluster.has_baremetal_nodes %} - - mas01 -{%- endif %} control: - ctl01 - gtw01 diff --git a/mcp/config/scenario/os-odl-nofeature-ha.yaml.j2 b/mcp/config/scenario/os-odl-nofeature-ha.yaml similarity index 77% rename from mcp/config/scenario/os-odl-nofeature-ha.yaml.j2 rename to mcp/config/scenario/os-odl-nofeature-ha.yaml index b31dc136e..51d476de5 100644 --- a/mcp/config/scenario/os-odl-nofeature-ha.yaml.j2 +++ b/mcp/config/scenario/os-odl-nofeature-ha.yaml @@ -5,28 +5,15 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -{%- import 'net_map.j2' as nm with context %} --- cluster: domain: mcp-odl-ha.local states: - - virtual_init -{%- if nm.cluster.has_baremetal_nodes %} - - maas - - baremetal_init -{%- endif %} -{%- if conf.MCP_VCP %} - - virtual_control_plane -{%- endif %} - opendaylight - openstack_ha - networks virtual: nodes: - infra: -{%- if nm.cluster.has_baremetal_nodes %} - - mas01 -{%- endif %} control: - kvm01 - kvm02 diff --git a/mcp/config/scenario/os-odl-nofeature-noha.yaml.j2 b/mcp/config/scenario/os-odl-nofeature-noha.yaml similarity index 77% rename from mcp/config/scenario/os-odl-nofeature-noha.yaml.j2 rename to mcp/config/scenario/os-odl-nofeature-noha.yaml index 2a10a3163..3133d0e62 100644 --- a/mcp/config/scenario/os-odl-nofeature-noha.yaml.j2 +++ b/mcp/config/scenario/os-odl-nofeature-noha.yaml @@ -5,26 +5,16 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -{%- import 'net_map.j2' as nm with context %} --- cluster: domain: mcp-odl-noha.local states: - - virtual_init -{%- if nm.cluster.has_baremetal_nodes %} - - maas - - baremetal_init -{%- endif %} - opendaylight - openstack_noha - neutron_gateway - networks virtual: nodes: - infra: -{%- if nm.cluster.has_baremetal_nodes %} - - mas01 -{%- endif %} control: - ctl01 - gtw01 diff --git a/mcp/config/scenario/os-odl-ovs-noha.yaml.j2 b/mcp/config/scenario/os-odl-ovs-noha.yaml similarity index 79% rename from mcp/config/scenario/os-odl-ovs-noha.yaml.j2 rename to mcp/config/scenario/os-odl-ovs-noha.yaml index 62c120b26..e2df6a476 100644 --- a/mcp/config/scenario/os-odl-ovs-noha.yaml.j2 +++ b/mcp/config/scenario/os-odl-ovs-noha.yaml @@ -5,16 +5,10 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -{%- import 'net_map.j2' as nm with context %} --- cluster: domain: mcp-odl-noha.local states: - - virtual_init -{%- if nm.cluster.has_baremetal_nodes %} - - maas - - baremetal_init -{%- endif %} - dpdk - opendaylight - openstack_noha @@ -22,10 +16,6 @@ cluster: - networks virtual: nodes: - infra: -{%- if nm.cluster.has_baremetal_nodes %} - - mas01 -{%- endif %} control: - ctl01 - gtw01 diff --git a/mcp/config/scenario/os-ovn-nofeature-ha.yaml.j2 b/mcp/config/scenario/os-ovn-nofeature-ha.yaml similarity index 77% rename from mcp/config/scenario/os-ovn-nofeature-ha.yaml.j2 rename to mcp/config/scenario/os-ovn-nofeature-ha.yaml index 021548f63..f76b0dce4 100644 --- a/mcp/config/scenario/os-ovn-nofeature-ha.yaml.j2 +++ b/mcp/config/scenario/os-ovn-nofeature-ha.yaml @@ -5,27 +5,14 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -{%- import 'net_map.j2' as nm with context %} --- cluster: domain: mcp-ovn-ha.local states: - - virtual_init -{%- if nm.cluster.has_baremetal_nodes %} - - maas - - baremetal_init -{%- endif %} -{%- if conf.MCP_VCP %} - - virtual_control_plane -{%- endif %} - openstack_ha - networks virtual: nodes: - infra: -{%- if nm.cluster.has_baremetal_nodes %} - - mas01 -{%- endif %} control: - kvm01 - kvm02 diff --git a/mcp/config/scenario/os-ovn-nofeature-noha.yaml.j2 b/mcp/config/scenario/os-ovn-nofeature-noha.yaml similarity index 76% rename from mcp/config/scenario/os-ovn-nofeature-noha.yaml.j2 rename to mcp/config/scenario/os-ovn-nofeature-noha.yaml index 635106355..0369f3fe9 100644 --- a/mcp/config/scenario/os-ovn-nofeature-noha.yaml.j2 +++ b/mcp/config/scenario/os-ovn-nofeature-noha.yaml @@ -5,24 +5,14 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -{%- import 'net_map.j2' as nm with context %} --- cluster: domain: mcp-ovn-noha.local states: - - virtual_init -{%- if nm.cluster.has_baremetal_nodes %} - - maas - - baremetal_init -{%- endif %} - openstack_noha - networks virtual: nodes: - infra: -{%- if nm.cluster.has_baremetal_nodes %} - - mas01 -{%- endif %} control: - ctl01 compute: diff --git a/mcp/scripts/xdf_data.sh.j2 b/mcp/scripts/xdf_data.sh.j2 index b8c32135c..ee5fffab7 100644 --- a/mcp/scripts/xdf_data.sh.j2 +++ b/mcp/scripts/xdf_data.sh.j2 @@ -14,6 +14,7 @@ {%- import 'net_map.j2' as nm with context -%} {%- set arch = conf[conf.MCP_JUMP_ARCH] -%} {%- set V = conf.virtual -%} +{%- do V.nodes.update(arch.default.virtual.nodes) -%} {%- set section_map = { 'infra': -1, 'control': nm.ctl01.idx, @@ -87,7 +88,7 @@ OPNFV_BRIDGES=( ) export CLUSTER_DOMAIN={{ conf.cluster.domain }} -cluster_states={{ bash_arr(conf.cluster.states) }} +cluster_states={{ bash_arr(arch.default.cluster.states + conf.cluster.states) }} virtual_nodes={{ filter_nodes('virtual') }} control_nodes_query={{ filter_nodes(['baremetal', 'virtual'], True, ['control']) }} base_image={{ arch.base_image }} -- 2.16.6