diff options
author | Linda Wang <wangwulin@huawei.com> | 2017-11-17 02:00:21 +0000 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2017-11-20 15:14:25 +0100 |
commit | 3b80954f3caf36a957e7193db793ce318d51e58c (patch) | |
tree | a142d8bbf2af31f9418d9fb3198b76638fd92a96 | |
parent | 06421562d075f6e9d12a0b43e1dce1982b035d59 (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>
(cherry picked from commit aa7109d038a86f6a19a9fb4af96bd1199cd81330)
-rw-r--r-- | functest/opnfv_tests/openstack/snaps/snaps_utils.py | 10 |
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 "" |