Allow scenarios without external network 24/68224/1
authorCédric Ollivier <cedric.ollivier@orange.com>
Wed, 10 Jul 2019 20:13:37 +0000 (22:13 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Thu, 11 Jul 2019 08:00:38 +0000 (10:00 +0200)
It allows creating testcases leveraging on Functest scenarios without
external network. Then Rally can verify network providers by only
skipping NovaServers.boot_server_associate_and_dissociate_floating_ip

Change-Id: I07a9348214f7557195c7201466f7e37b2b980206
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit a30e0c35f248cc9225e628e3a64723b2184d6087)

functest/core/tenantnetwork.py
functest/opnfv_tests/openstack/rally/blacklist.yaml
functest/opnfv_tests/openstack/rally/rally.py

index 7b2bf87..ae739ac 100644 (file)
@@ -146,6 +146,7 @@ class TenantNetwork1(testcase.TestCase):
     __logger = logging.getLogger(__name__)
     cidr = '192.168.120.0/24'
     shared_network = False
+    allow_no_fip = False
 
     def __init__(self, **kwargs):
         if "case_name" not in kwargs:
@@ -164,6 +165,7 @@ class TenantNetwork1(testcase.TestCase):
         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")
         self.guid = str(uuid.uuid4())
         self.network = None
@@ -216,7 +218,8 @@ class TenantNetwork1(testcase.TestCase):
         Raises: expection on error
         """
         assert self.cloud
-        assert self.ext_net
+        if not self.allow_no_fip:
+            assert self.ext_net
         provider = {}
         if hasattr(config.CONF, '{}_network_type'.format(self.case_name)):
             provider["network_type"] = getattr(
@@ -251,7 +254,7 @@ class TenantNetwork1(testcase.TestCase):
 
         self.router = self.cloud.create_router(
             name='{}-router_{}'.format(self.case_name, self.guid),
-            ext_gateway_net_id=self.ext_net.id)
+            ext_gateway_net_id=self.ext_net.id if self.ext_net else None)
         self.__logger.debug("router: %s", self.router)
         self.cloud.add_router_interface(self.router, subnet_id=self.subnet.id)
 
index 77c5142..beed15c 100644 (file)
@@ -28,3 +28,8 @@ functionality:
             - no_net_trunk_service
         tests:
             - '^NeutronTrunk'
+    -
+        functions:
+            - no_floating_ip
+        tests:
+            - NovaServers.boot_server_associate_and_dissociate_floating_ip
index 08811c0..f3d41b2 100644 (file)
@@ -66,6 +66,7 @@ class RallyBase(singlevm.VmReady2):
 
     visibility = 'public'
     shared_network = True
+    allow_no_fip = True
 
     def __init__(self, **kwargs):
         """Initialize RallyBase object."""
@@ -334,6 +335,8 @@ class RallyBase(singlevm.VmReady2):
                 func_list.append("no_migration")
             if not self._network_trunk_supported():
                 func_list.append("no_net_trunk_service")
+            if not self.ext_net:
+                func_list.append("no_floating_ip")
 
             if 'functionality' in black_list_yaml.keys():
                 for item in black_list_yaml['functionality']: