If ext net is not found, skip the vm2vm tests
No need to create a fake ext net since the connectivity to
it will not work anyway. The correct way at the real envs
is to skip the vm2vm tests in case the external network
is not found.
Related-PROD: PROD-36943
Change-Id: Id45f226834fea56bb93b0a93dc8295a598023c53
diff --git a/utils/os_client.py b/utils/os_client.py
index d00e662..0e2ab23 100644
--- a/utils/os_client.py
+++ b/utils/os_client.py
@@ -223,7 +223,6 @@
class OSCliActions(object):
def __init__(self, os_clients):
self.os_clients = os_clients
- self.create_fake_ext_net = False
def get_project_by_name(self, name):
return self.os_clients.auth.projects.find(
@@ -241,37 +240,6 @@
net = self.create_network_resources()
return net
- def create_fake_external_network(self):
- logger.info(
- "Could not find any external network, creating a fake one...")
- net_name = "spt-ext-net-{}".format(random.randrange(100, 999))
- net_body = {"network": {"name": net_name,
- "router:external": True,
- "provider:network_type": "local"}}
- try:
- ext_net = \
- self.os_clients.network.create_network(net_body)['network']
- logger.info("Created a fake external net {}".format(net_name))
- except Exception as e:
- # in case 'local' net type is absent, create with default type
- net_body["network"].pop('provider:network_type', None)
- ext_net = \
- self.os_clients.network.create_network(net_body)['network']
- subnet_name = "spt-ext-subnet-{}".format(random.randrange(100, 999))
- subnet_body = {
- "subnet": {
- "name": subnet_name,
- "network_id": ext_net["id"],
- "ip_version": 4,
- "cidr": "10.255.255.0/24",
- "allocation_pools": [{"start": "10.255.255.100",
- "end": "10.255.255.200"}]
- }
- }
- self.os_clients.network.create_subnet(subnet_body)
- self.create_fake_ext_net = True
- return ext_net
-
def get_external_network(self):
config = utils.get_configuration()
ext_net = config.get('external_network') or ''
@@ -291,7 +259,7 @@
ext_net = networks[0]
logger.info("Using external net '{}'".format(ext_net["name"]))
else:
- ext_net = self.create_fake_external_network()
+ return None
return ext_net
def create_flavor(self, name, ram=256, vcpus=1, disk=2):