aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-08-21 14:35:19 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-08-21 14:35:19 +0000
commitf9fc2c1df0c6293df3f7c5e413a8aab643a4177a (patch)
tree3a64c5a7c22592653fa318cd494e016b9cafb210
parentcfd987a6ce153be88413a38ade2bea3af2f32dcd (diff)
parent1c3cf9de8106ab9c1e707929385ecc7bf2974387 (diff)
Merge "Specify valid external network as an env"
-rw-r--r--functest/utils/openstack_utils.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index 335f14cd1..8b59c9547 100644
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -22,8 +22,8 @@ from heatclient import client as heatclient
from novaclient import client as novaclient
from keystoneclient import client as keystoneclient
from neutronclient.neutron import client as neutronclient
-from functest.utils.constants import CONST
+from functest.utils.constants import CONST
import functest.utils.functest_utils as ft_utils
logger = logging.getLogger(__name__)
@@ -713,6 +713,8 @@ def get_private_net(neutron_client):
def get_external_net(neutron_client):
+ if (hasattr(CONST, 'EXTERNAL_NETWORK')):
+ return CONST.__getattribute__('EXTERNAL_NETWORK')
for network in neutron_client.list_networks()['networks']:
if network['router:external']:
return network['name']
@@ -720,6 +722,11 @@ def get_external_net(neutron_client):
def get_external_net_id(neutron_client):
+ if (hasattr(CONST, 'EXTERNAL_NETWORK')):
+ networks = neutron_client.list_networks(
+ name=CONST.__getattribute__('EXTERNAL_NETWORK'))
+ net_id = networks['networks'][0]['id']
+ return net_id
for network in neutron_client.list_networks()['networks']:
if network['router:external']:
return network['id']