aboutsummaryrefslogtreecommitdiffstats
path: root/functest
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-11-17 02:00:21 +0000
committerLinda Wang <wangwulin@huawei.com>2017-11-20 09:02:44 +0000
commitaa7109d038a86f6a19a9fb4af96bd1199cd81330 (patch)
tree018dfd1b34c5f43eccf5a2e2dd4d018c4e71f072 /functest
parenta62233a19e60ca2c13bcbf0f477a0652842c89b6 (diff)
Support to specify the valid external network name
In some deployments, the retrieved external network by the def get_external_networks in Snaps checked by "router:external" is not available. So it is necessary to specify the available external network as an env by user. Change-Id: I333e91dd106ed307541a9a197280199fde86bd30 Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'functest')
-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 c3cd6245e..284e88b51 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 ""