diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2020-11-14 15:31:43 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2020-11-14 17:10:29 +0100 |
commit | 2200415f7409d056d1403680414460f23467a67c (patch) | |
tree | ff1de2f695b011244481cb3ed99e149fd3d62c78 | |
parent | 2276d42c6e2ce1afc62aae70935824032b0ca98e (diff) |
Allow connecting vm to the external network
It fits the Airship deployment where there is neither tenant networks
nor floating ips. It only updates the scenarios and must be completed
by other changes for all the advanced testcases (Rally, Tempest, etc)
Change-Id: Ia19f24d484b7b384c4aeeb3be35aac7aee31baab
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit d99e61f9eb1c4a582b71eb304259ddd3fdeb748f)
-rw-r--r-- | docker/healthcheck/testcases.yaml | 4 | ||||
-rw-r--r-- | functest/ci/testcases.yaml | 4 | ||||
-rw-r--r-- | functest/core/singlevm.py | 18 | ||||
-rw-r--r-- | functest/core/tenantnetwork.py | 3 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/api/connection_check.py | 4 | ||||
-rw-r--r-- | functest/utils/env.py | 3 |
6 files changed, 27 insertions, 9 deletions
diff --git a/docker/healthcheck/testcases.yaml b/docker/healthcheck/testcases.yaml index ff743f0d4..3ebe8cb67 100644 --- a/docker/healthcheck/testcases.yaml +++ b/docker/healthcheck/testcases.yaml @@ -27,6 +27,8 @@ tiers: It creates and configures all tenant network ressources required by advanced testcases (subnet, network and router). + dependencies: + - NO_TENANT_NETWORK: '^(?![tT]rue$)' run: name: tenantnetwork1 @@ -39,6 +41,8 @@ tiers: It creates new user/project before creating and configuring all tenant network ressources required by a testcase (subnet, network and router). + dependencies: + - NO_TENANT_NETWORK: '^(?![tT]rue$)' run: name: tenantnetwork2 diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index aa2b205ef..e0e31c29e 100644 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -27,6 +27,8 @@ tiers: It creates and configures all tenant network ressources required by advanced testcases (subnet, network and router). + dependencies: + - NO_TENANT_NETWORK: '^(?![tT]rue$)' run: name: tenantnetwork1 @@ -39,6 +41,8 @@ tiers: It creates new user/project before creating and configuring all tenant network ressources required by a testcase (subnet, network and router). + dependencies: + - NO_TENANT_NETWORK: '^(?![tT]rue$)' run: name: tenantnetwork2 diff --git a/functest/core/singlevm.py b/functest/core/singlevm.py index bfaa53bfc..3d968cfd6 100644 --- a/functest/core/singlevm.py +++ b/functest/core/singlevm.py @@ -212,7 +212,9 @@ class VmReady1(tenantnetwork.TenantNetwork1): vm1 = self.cloud.create_server( name if name else '{}-vm_{}'.format(self.case_name, self.guid), image=self.image.id, flavor=self.flavor.id, - auto_ip=False, network=self.network.id, + auto_ip=False, + network=self.network.id if self.network else env.get( + "EXTERNAL_NETWORK"), timeout=self.create_server_timeout, wait=True, **kwargs) self.__logger.debug("vm: %s", vm1) return vm1 @@ -416,10 +418,12 @@ class SingleVm1(VmReady1): - None on error """ assert vm1 - fip = self.cloud.create_floating_ip( - network=self.ext_net.id, server=vm1, wait=True, - timeout=self.create_floating_ip_timeout) - self.__logger.debug("floating_ip: %s", fip) + fip = None + if env.get('NO_TENANT_NETWORK').lower() != 'true': + fip = self.cloud.create_floating_ip( + network=self.ext_net.id, server=vm1, wait=True, + timeout=self.create_floating_ip_timeout) + self.__logger.debug("floating_ip: %s", fip) ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.client.AutoAddPolicy()) for loop in range(self.ssh_connect_loops): @@ -427,7 +431,7 @@ class SingleVm1(VmReady1): p_console = self.cloud.get_server_console(vm1) self.__logger.debug("vm console: \n%s", p_console) ssh.connect( - fip.floating_ip_address, + fip.floating_ip_address if fip else vm1.public_v4, username=getattr( config.CONF, '{}_image_user'.format(self.case_name), self.username), @@ -440,7 +444,7 @@ class SingleVm1(VmReady1): except Exception as exc: # pylint: disable=broad-except self.__logger.debug( "try %s: cannot connect to %s: %s", loop + 1, - fip.floating_ip_address, exc) + fip.floating_ip_address if fip else vm1.public_v4, exc) time.sleep(9) else: self.__logger.error( diff --git a/functest/core/tenantnetwork.py b/functest/core/tenantnetwork.py index 8dd56aa67..366477d00 100644 --- a/functest/core/tenantnetwork.py +++ b/functest/core/tenantnetwork.py @@ -268,7 +268,8 @@ class TenantNetwork1(testcase.TestCase): try: assert self.cloud self.start_time = time.time() - self.create_network_resources() + if env.get('NO_TENANT_NETWORK').lower() != 'true': + self.create_network_resources() self.result = 100 status = testcase.TestCase.EX_OK except Exception: # pylint: disable=broad-except diff --git a/functest/opnfv_tests/openstack/api/connection_check.py b/functest/opnfv_tests/openstack/api/connection_check.py index adca30ee9..83b72b65b 100644 --- a/functest/opnfv_tests/openstack/api/connection_check.py +++ b/functest/opnfv_tests/openstack/api/connection_check.py @@ -16,6 +16,7 @@ import os_client_config import shade from xtesting.core import testcase +from functest.utils import env from functest.utils import functest_utils @@ -51,6 +52,9 @@ class ConnectionCheck(testcase.TestCase): self.start_time = time.time() self.__logger.debug( "list_services: %s", functest_utils.list_services(self.cloud)) + if env.get('NO_TENANT_NETWORK').lower() == 'true': + self.func_list.remove("list_floating_ip_pools") + self.func_list.remove("list_floating_ips") for func in self.func_list: self.__logger.debug( "%s: %s", func, getattr(self.cloud, func)()) diff --git a/functest/utils/env.py b/functest/utils/env.py index 672aee1d9..2e312726c 100644 --- a/functest/utils/env.py +++ b/functest/utils/env.py @@ -40,7 +40,8 @@ INPUTS = { 'SKIP_DOWN_HYPERVISORS': 'False', 'PUBLIC_ENDPOINT_ONLY': 'False', 'DASHBOARD_URL': '', - 'VMTP_HYPERVISORS': '' + 'VMTP_HYPERVISORS': '', + 'NO_TENANT_NETWORK': 'False' } |