From 909f355dd5195e81b45a14f88f6f879ee4c8867d Mon Sep 17 00:00:00 2001 From: Feng Pan Date: Mon, 16 Oct 2017 13:17:49 -0400 Subject: Fix interface role mapping config for odl-fdio scenarios This patch fixes a bug in deploy config function that will make performance parameters overwrite interface role mapping config for honeycomb. apex-os-net-config: Ifa3b18aa6370c79ad6ad3ce983f1648ff0d1d79d Change-Id: Icdb7603577bc7edf1959238ddd3d686c310544ce Signed-off-by: Feng Pan (cherry picked from commit da99ee8cf99824a7ee5ff19544d3eec4788edd68) --- apex/overcloud/deploy.py | 40 ++++++++++++++++++++------------ apex/tests/test_apex_overcloud_deploy.py | 30 ++++++++++++++++++------ 2 files changed, 48 insertions(+), 22 deletions(-) diff --git a/apex/overcloud/deploy.py b/apex/overcloud/deploy.py index ef916a43..8016e1fd 100644 --- a/apex/overcloud/deploy.py +++ b/apex/overcloud/deploy.py @@ -306,8 +306,12 @@ def prep_env(ds, ns, inv, opnfv_env, net_env, tmp_dir): tmp_opnfv_env = os.path.join(tmp_dir, os.path.basename(opnfv_env)) shutil.copyfile(opnfv_env, tmp_opnfv_env) tenant_nic_map = ns['networks']['tenant']['nic_mapping'] - tenant_ctrl_nic = tenant_nic_map['controller']['members'][0] - tenant_comp_nic = tenant_nic_map['compute']['members'][0] + tenant_nic = dict() + tenant_nic['Controller'] = tenant_nic_map['controller']['members'][0] + tenant_nic['NovaCompute'] = tenant_nic_map['compute']['members'][0] + external_nic_map = ns['networks']['external'][0]['nic_mapping'] + external_nic = dict() + external_nic['NovaCompute'] = external_nic_map['compute']['members'][0] # SSH keys private_key, public_key = make_ssh_key() @@ -361,22 +365,10 @@ def prep_env(ds, ns, inv, opnfv_env, net_env, tmp_dir): output_line = (" opendaylight::vpp_routing_node: {}.{}" .format(ds_opts['odl_vpp_routing_node'], ns['domain_name'])) - elif 'ControllerExtraConfig' in line: - output_line = (" ControllerExtraConfig:\n " - "tripleo::profile::base::neutron::agents::" - "honeycomb::interface_role_mapping:" - " ['{}:tenant-interface]'" - .format(tenant_ctrl_nic)) - elif 'NovaComputeExtraConfig' in line: - output_line = (" NovaComputeExtraConfig:\n " - "tripleo::profile::base::neutron::agents::" - "honeycomb::interface_role_mapping:" - " ['{}:tenant-interface]'" - .format(tenant_comp_nic)) elif not ds_opts['sdn_controller'] and ds_opts['dataplane'] == 'fdio': if 'NeutronVPPAgentPhysnets' in line: output_line = (" NeutronVPPAgentPhysnets: 'datacentre:{}'". - format(tenant_ctrl_nic)) + format(tenant_nic['Controller'])) elif ds_opts['sdn_controller'] == 'opendaylight' and ds_opts.get( 'dvr') is True: if 'OS::TripleO::Services::NeutronDhcpAgent' in line: @@ -405,6 +397,24 @@ def prep_env(ds, ns, inv, opnfv_env, net_env, tmp_dir): perf_line += ("\n " "fdio::vpp_cpu_corelist_workers: '{}'" .format(perf_opts['corelist-workers'])) + if ds_opts['sdn_controller'] == 'opendaylight' and \ + ds_opts['dataplane'] == 'fdio': + if role == 'NovaCompute': + perf_line += ("\n " + "tripleo::profile::base::neutron::" + "agents::honeycomb::" + "interface_role_mapping:" + " ['{}:tenant-interface'," + "'{}:public-interface']" + .format(tenant_nic[role], + external_nic[role])) + else: + perf_line += ("\n " + "tripleo::profile::base::neutron::" + "agents::honeycomb::" + "interface_role_mapping:" + " ['{}:tenant-interface']" + .format(tenant_nic[role])) if perf_line: output_line = (" {}:{}".format(cfg, perf_line)) diff --git a/apex/tests/test_apex_overcloud_deploy.py b/apex/tests/test_apex_overcloud_deploy.py index 1df10e4e..59e9048f 100644 --- a/apex/tests/test_apex_overcloud_deploy.py +++ b/apex/tests/test_apex_overcloud_deploy.py @@ -245,9 +245,14 @@ class TestOvercloudDeploy(unittest.TestCase): 'networks': {'tenant': {'nic_mapping': {'controller': - {'members': ['test']}, + {'members': ['tenant_nic']}, 'compute': - {'members': ['test']}}}}} + {'members': ['tenant_nic']}}}, + 'external': + [{'nic_mapping': {'controller': + {'members': ['ext_nic']}, + 'compute': + {'members': ['ext_nic']}}}]}} inv = None try: # Swap stdout @@ -279,9 +284,14 @@ class TestOvercloudDeploy(unittest.TestCase): 'networks': {'tenant': {'nic_mapping': {'controller': - {'members': ['test']}, + {'members': ['tenant_nic']}, 'compute': - {'members': ['test']}}}}} + {'members': ['tenant_nic']}}}, + 'external': + [{'nic_mapping': {'controller': + {'members': ['ext_nic']}, + 'compute': + {'members': ['ext_nic']}}}]}} inv = None try: # Swap stdout @@ -291,7 +301,8 @@ class TestOvercloudDeploy(unittest.TestCase): # run test prep_env(ds, ns, inv, 'opnfv-env.yml', '/net-env.yml', '/tmp') output = out.getvalue().strip() - assert_in('NeutronVPPAgentPhysnets: \'datacentre:test\'', output) + assert_in('NeutronVPPAgentPhysnets: \'datacentre:tenant_nic\'', + output) assert_in('NeutronVPPAgentPhysnets', output) finally: # put stdout back @@ -311,9 +322,14 @@ class TestOvercloudDeploy(unittest.TestCase): 'networks': {'tenant': {'nic_mapping': {'controller': - {'members': ['test']}, + {'members': ['tenant_nic']}, 'compute': - {'members': ['test']}}}}} + {'members': ['tenant_nic']}}}, + 'external': + [{'nic_mapping': {'controller': + {'members': ['ext_nic']}, + 'compute': + {'members': ['ext_nic']}}}]}} inv = MagicMock() inv.get_node_counts.return_value = (3, 2) try: -- cgit 1.2.3-korg