aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-11-20 12:51:45 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-11-20 12:51:45 +0000
commit11c21239ace9bd45abf4e79bb52dc13f06ae43ee (patch)
tree2ca34e476c34ebfb5e1593424fc1ea53998757a8 /functest/opnfv_tests/openstack
parentf8460182ebb264212f395e873594f84d41963243 (diff)
parentaa7109d038a86f6a19a9fb4af96bd1199cd81330 (diff)
Merge "Support to specify the valid external network name"
Diffstat (limited to 'functest/opnfv_tests/openstack')
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_utils.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_utils.py b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
index c3cd6245..284e88b5 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_utils.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
@@ -5,17 +5,25 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
+from functest.utils.constants import CONST
+
from snaps.openstack.utils import neutron_utils, nova_utils
def get_ext_net_name(os_creds):
"""
- Returns the first external network name
+ Returns the configured external network name or
+ the first retrieved external network name
:param: os_creds: an instance of snaps OSCreds object
:return:
"""
neutron = neutron_utils.neutron_client(os_creds)
ext_nets = neutron_utils.get_external_networks(neutron)
+ if (hasattr(CONST, 'EXTERNAL_NETWORK')):
+ extnet_config = CONST.__getattribute__('EXTERNAL_NETWORK')
+ for ext_net in ext_nets:
+ if ext_net.name == extnet_config:
+ return extnet_config
return ext_nets[0].name if ext_nets else ""