aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2020-11-27 13:26:46 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2020-11-27 13:27:48 +0100
commitfd7293958d4ace02801857069f8eecfc6113bdf1 (patch)
tree1e1405b57c251033473e090075e1eda5295ecbdb
parent28a707958ea75dd40b45d5fabe8822307d8e5e16 (diff)
Protect vs false detected external networks if l2-only
Change-Id: I0e58c9df0e9971fcdae5fa7b209940569ae51a78 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 3ab6d5693cb303fb73049287e772713a99f84be7)
-rw-r--r--functest/core/tenantnetwork.py12
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py6
2 files changed, 10 insertions, 8 deletions
diff --git a/functest/core/tenantnetwork.py b/functest/core/tenantnetwork.py
index 157cb149b..8b820cea5 100644
--- a/functest/core/tenantnetwork.py
+++ b/functest/core/tenantnetwork.py
@@ -155,19 +155,19 @@ class TenantNetwork1(testcase.TestCase):
self.res_dir = os.path.join(self.dir_results, self.case_name)
self.output_log_name = 'functest.log'
self.output_debug_log_name = 'functest.debug.log'
+ self.ext_net = None
try:
cloud_config = os_client_config.get_config()
self.cloud = self.orig_cloud = shade.OpenStackCloud(
cloud_config=cloud_config)
except Exception: # pylint: disable=broad-except
self.cloud = self.orig_cloud = None
- self.ext_net = None
self.__logger.exception("Cannot connect to Cloud")
- try:
- self.ext_net = self.get_external_network(self.cloud)
- except Exception: # pylint: disable=broad-except
- self.ext_net = None
- self.__logger.exception("Cannot get the external network")
+ if env.get('NO_TENANT_NETWORK').lower() != 'true':
+ try:
+ self.ext_net = self.get_external_network(self.cloud)
+ except Exception: # pylint: disable=broad-except
+ self.__logger.exception("Cannot get the external network")
self.guid = str(uuid.uuid4())
self.network = None
self.subnet = None
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index fc92a69b0..ed3c4761f 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -502,12 +502,14 @@ class TempestCommon(singlevm.VmReady2):
"""Update network section in tempest.conf"""
rconfig = configparser.RawConfigParser()
rconfig.read(self.conf_file)
- if not rconfig.has_section('network'):
- rconfig.add_section('network')
if self.ext_net:
+ if not rconfig.has_section('network'):
+ rconfig.add_section('network')
rconfig.set('network', 'public_network_id', self.ext_net.id)
rconfig.set('network', 'floating_network_name', self.ext_net.name)
else:
+ if not rconfig.has_section('network-feature-enabled'):
+ rconfig.add_section('network-feature-enabled')
rconfig.set('network-feature-enabled', 'floating_ips', False)
with open(self.conf_file, 'w') as config_file:
rconfig.write(config_file)