summaryrefslogtreecommitdiffstats
path: root/apex
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2018-04-19 04:12:15 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-04-19 04:12:15 +0000
commit94ce44fe6e3450a1217ec3838a43049e53da9f6e (patch)
tree9f28e8e1517415e50258493ed0d15ba50ad8941a /apex
parentbfe5aaa753e0ba5397b68e72b99057950db12b86 (diff)
parent5acf4e708c68147ef20c67f8d4648e6027c1e20d (diff)
Merge "Fix nosdn fdio scenario"
Diffstat (limited to 'apex')
-rw-r--r--apex/deploy.py2
-rw-r--r--apex/overcloud/deploy.py18
-rw-r--r--apex/tests/test_apex_overcloud_deploy.py40
3 files changed, 51 insertions, 9 deletions
diff --git a/apex/deploy.py b/apex/deploy.py
index 4facade..bc4d078 100644
--- a/apex/deploy.py
+++ b/apex/deploy.py
@@ -515,7 +515,7 @@ def main():
'UserKnownHostsFile=/dev/null -o ' \
'LogLevel=error'
deploy_vars['external_network_cmds'] = \
- oc_deploy.external_network_cmds(net_settings)
+ oc_deploy.external_network_cmds(net_settings, deploy_settings)
# TODO(trozet): just parse all ds_opts as deploy vars one time
deploy_vars['gluon'] = ds_opts['gluon']
deploy_vars['sdn'] = ds_opts['sdn_controller']
diff --git a/apex/overcloud/deploy.py b/apex/overcloud/deploy.py
index 3fb812e..03e5652 100644
--- a/apex/overcloud/deploy.py
+++ b/apex/overcloud/deploy.py
@@ -547,8 +547,11 @@ def prep_env(ds, ns, inv, opnfv_env, net_env, tmp_dir):
ns['domain_name']))
elif not ds_opts['sdn_controller'] and ds_opts['dataplane'] == 'fdio':
if 'NeutronVPPAgentPhysnets' in line:
- output_line = (" NeutronVPPAgentPhysnets: 'datacentre:{}'".
- format(tenant_nic['Controller']))
+ # VPP interface tap0 will be used for external network
+ # connectivity.
+ output_line = (" NeutronVPPAgentPhysnets: "
+ "'datacentre:{},external:tap0'"
+ .format(tenant_nic['Controller']))
elif ds_opts['sdn_controller'] == 'opendaylight' and ds_opts.get(
'dvr') is True:
if 'OS::TripleO::Services::NeutronDhcpAgent' in line:
@@ -752,12 +755,18 @@ def prep_sriov_env(ds, tmp_dir):
print(line)
-def external_network_cmds(ns):
+def external_network_cmds(ns, ds):
"""
Generates external network openstack commands
:param ns: network settings
+ :param ds: deploy settings
:return: list of commands to configure external network
"""
+ ds_opts = ds['deploy_options']
+ external_physnet = 'datacentre'
+ if ds_opts['dataplane'] == 'fdio' and \
+ ds_opts['sdn_controller'] != 'opendaylight':
+ external_physnet = 'external'
if 'external' in ns.enabled_network_list:
net_config = ns['networks']['external'][0]
external = True
@@ -778,7 +787,8 @@ def external_network_cmds(ns):
'compute']['vlan'])
cmds.append("openstack network create external --project service "
"--external --provider-network-type {} "
- "--provider-physical-network datacentre".format(ext_type))
+ "--provider-physical-network {}"
+ .format(ext_type, external_physnet))
# create subnet command
cidr = net_config['cidr']
subnet_cmd = "openstack subnet create external-subnet --project " \
diff --git a/apex/tests/test_apex_overcloud_deploy.py b/apex/tests/test_apex_overcloud_deploy.py
index 6898d36..ae2e8f0 100644
--- a/apex/tests/test_apex_overcloud_deploy.py
+++ b/apex/tests/test_apex_overcloud_deploy.py
@@ -404,7 +404,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:tenant_nic\'',
+ assert_in('NeutronVPPAgentPhysnets: '
+ '\'datacentre:tenant_nic,external:tap0\'',
output)
assert_in('NeutronVPPAgentPhysnets', output)
finally:
@@ -562,6 +563,10 @@ class TestOvercloudDeploy(unittest.TestCase):
assert_raises(ApexDeployException, prep_sriov_env, ds, '/tmp')
def test_external_network_cmds(self):
+ ds = {'deploy_options':
+ {'sdn_controller': 'opendaylight',
+ 'dataplane': 'ovs'}}
+
cidr = MagicMock()
cidr.version = 6
ns_dict = {'networks':
@@ -573,13 +578,41 @@ class TestOvercloudDeploy(unittest.TestCase):
ns = MagicMock()
ns.enabled_network_list = ['external']
ns.__getitem__.side_effect = lambda i: ns_dict.get(i, MagicMock())
- cmds = ' '.join(external_network_cmds(ns))
+ cmds = ' '.join(external_network_cmds(ns, ds))
assert_in('--external', cmds)
assert_in('--allocation-pool start=0,end=1', cmds)
assert_in('--gateway gw', cmds)
assert_in('--network external', cmds)
+ assert_in('--provider-physical-network datacentre', cmds)
+
+ def test_external_network_cmds_nosdn_fdio(self):
+ ds = {'deploy_options':
+ {'sdn_controller': False,
+ 'dataplane': 'fdio'}}
+
+ cidr = MagicMock()
+ cidr.version = 6
+ ns_dict = {'networks':
+ {'external': [{'floating_ip_range': (0, 1),
+ 'nic_mapping':
+ {'compute': {'vlan': 'native'}},
+ 'gateway': 'gw',
+ 'cidr': cidr}]}}
+ ns = MagicMock()
+ ns.enabled_network_list = ['external']
+ ns.__getitem__.side_effect = lambda i: ns_dict.get(i, MagicMock())
+ cmds = ' '.join(external_network_cmds(ns, ds))
+ assert_in('--external', cmds)
+ assert_in('--allocation-pool start=0,end=1', cmds)
+ assert_in('--gateway gw', cmds)
+ assert_in('--network external', cmds)
+ assert_in('--provider-physical-network external', cmds)
def test_external_network_cmds_no_ext(self):
+ ds = {'deploy_options':
+ {'sdn_controller': 'opendaylight',
+ 'dataplane': 'ovs'}}
+
cidr = MagicMock()
cidr.version = 6
ns_dict = {'apex':
@@ -593,8 +626,7 @@ class TestOvercloudDeploy(unittest.TestCase):
ns = MagicMock()
ns.enabled_network_list = ['admin']
ns.__getitem__.side_effect = lambda i: ns_dict.get(i, MagicMock())
- external_network_cmds(ns)
- cmds = ' '.join(external_network_cmds(ns))
+ cmds = ' '.join(external_network_cmds(ns, ds))
assert_in('--external', cmds)
assert_in('--allocation-pool start=0,end=1', cmds)
assert_in('--network external', cmds)