aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests
diff options
context:
space:
mode:
Diffstat (limited to 'functest/opnfv_tests')
-rw-r--r--functest/opnfv_tests/vnf/epc/juju_epc.py33
-rw-r--r--functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py30
-rw-r--r--functest/opnfv_tests/vnf/ims/orchestra_openims.py26
3 files changed, 49 insertions, 40 deletions
diff --git a/functest/opnfv_tests/vnf/epc/juju_epc.py b/functest/opnfv_tests/vnf/epc/juju_epc.py
index d9c14219..be0f3ab2 100644
--- a/functest/opnfv_tests/vnf/epc/juju_epc.py
+++ b/functest/opnfv_tests/vnf/epc/juju_epc.py
@@ -15,14 +15,14 @@ import time
import json
import sys
from copy import deepcopy
-import yaml
-import functest.utils.openstack_utils as os_utils
-import functest.core.vnf as vnf
-import pkg_resources
+from urlparse import urljoin
+import functest.core.vnf as vnf
from functest.opnfv_tests.openstack.snaps import snaps_utils
from functest.utils.constants import CONST
+import functest.utils.openstack_utils as os_utils
+import pkg_resources
from snaps.openstack.os_credentials import OSCreds
from snaps.openstack.create_network import (NetworkSettings,
SubnetSettings, OpenStackNetwork)
@@ -31,12 +31,14 @@ from snaps.openstack.create_flavor import (FlavorSettings, OpenStackFlavor)
from snaps.openstack.create_image import (ImageSettings, OpenStackImage)
from snaps.openstack.tests import openstack_tests
from snaps.openstack.utils import keystone_utils
+import yaml
__author__ = "Amarendra Meher <amarendra@rebaca.com>"
__author__ = "Soumaya K Nayek <soumaya.nayek@rebaca.com>"
class JujuEpc(vnf.VnfOnBoarding):
+ # pylint:disable=too-many-instance-attributes
"""Abot EPC deployed with JUJU Orchestrator Case"""
__logger = logging.getLogger(__name__)
@@ -94,6 +96,10 @@ class JujuEpc(vnf.VnfOnBoarding):
self.glance_client = os_utils.get_glance_client()
self.neutron_client = os_utils.get_neutron_client()
self.nova_client = os_utils.get_nova_client()
+ self.sec_group_id = None
+ self.public_auth_url = None
+ self.creds = None
+ self.filename = None
def prepare(self):
"""Prepare testcase (Additional pre-configuration steps)."""
@@ -104,6 +110,10 @@ class JujuEpc(vnf.VnfOnBoarding):
self.__logger.info("Additional pre-configuration steps")
self.public_auth_url = keystone_utils.get_endpoint(
self.snaps_creds, 'identity')
+ # it enforces a versioned public identity endpoint as juju simply
+ # adds /auth/tokens wich fails vs an unversioned endpoint.
+ if not self.public_auth_url.endswith(('v3', 'v3/', 'v2.0', 'v2.0/')):
+ self.public_auth_url = urljoin(self.public_auth_url, 'v3')
self.creds = {
"tenant": self.tenant_name,
@@ -127,7 +137,7 @@ class JujuEpc(vnf.VnfOnBoarding):
}
self.__logger.info("Cloud DATA: %s", cloud_data)
self.filename = os.path.join(self.case_dir, 'abot-epc.yaml')
- self.__logger.info("Cretae %s to add cloud info", self.filename)
+ self.__logger.info("Create %s to add cloud info", self.filename)
write_config(self.filename, CLOUD_TEMPLATE, **cloud_data)
if self.snaps_creds.identity_api_version == 3:
@@ -149,7 +159,7 @@ class JujuEpc(vnf.VnfOnBoarding):
image_creator.create()
self.created_object.append(image_creator)
- def deploy_orchestrator(self):
+ def deploy_orchestrator(self): # pylint: disable=too-many-locals
"""
Create network, subnet, router
@@ -288,8 +298,7 @@ class JujuEpc(vnf.VnfOnBoarding):
count = count + 1
os.system('juju-wait')
return True
- else:
- return False
+ return False
def test_vnf(self):
"""Run test on ABoT."""
@@ -455,8 +464,8 @@ def update_data(obj):
for tag in element['tags']:
element[tag['name']] = 1
- except:
- logging.error("Error in updating data, %s" % (sys.exc_info()[0]))
+ except Exception: # pylint: disable=broad-except
+ logging.error("Error in updating data, %s", sys.exc_info()[0])
raise
return obj
@@ -467,8 +476,8 @@ def get_instance_metadata(nova_client, instance):
try:
instance = nova_client.servers.get(instance.id)
return instance.metadata
- except Exception as e:
- logging.error("Error [get_instance_status(nova_client)]: %s" % e)
+ except Exception as exc: # pylint: disable=broad-except
+ logging.error("Error [get_instance_status(nova_client)]: %s", exc)
return None
diff --git a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py
index 4593a1b8..3db53e35 100644
--- a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py
+++ b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py
@@ -17,6 +17,13 @@ import time
import pkg_resources
import yaml
+import functest.core.vnf as vnf
+import functest.utils.openstack_utils as os_utils
+from functest.opnfv_tests.openstack.snaps import snaps_utils
+from functest.utils.constants import CONST
+
+from org.openbaton.cli.errors.errors import NfvoException
+from org.openbaton.cli.agents.agents import MainAgent
from snaps.config.flavor import FlavorConfig
from snaps.config.image import ImageConfig
from snaps.config.network import NetworkConfig, PortConfig, SubnetConfig
@@ -24,7 +31,7 @@ from snaps.config.router import RouterConfig
from snaps.config.security_group import (
Direction, Protocol, SecurityGroupConfig, SecurityGroupRuleConfig)
from snaps.config.vm_inst import VmInstanceConfig
-
+from snaps.openstack.utils import keystone_utils
from snaps.openstack.create_flavor import OpenStackFlavor
from snaps.openstack.create_image import OpenStackImage
from snaps.openstack.create_instance import OpenStackVmInstance
@@ -32,15 +39,6 @@ from snaps.openstack.create_network import OpenStackNetwork
from snaps.openstack.create_router import OpenStackRouter
from snaps.openstack.create_security_group import OpenStackSecurityGroup
-from functest.opnfv_tests.openstack.snaps import snaps_utils
-
-import functest.core.vnf as vnf
-import functest.utils.openstack_utils as os_utils
-from functest.utils.constants import CONST
-
-from org.openbaton.cli.errors.errors import NfvoException
-from org.openbaton.cli.agents.agents import MainAgent
-
__author__ = "Pauls, Michael <michael.pauls@fokus.fraunhofer.de>"
# ----------------------------------------------------------
@@ -209,11 +207,14 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding):
self.logger.info("Additional pre-configuration steps")
+ public_auth_url = keystone_utils.get_endpoint(
+ self.snaps_creds, 'identity')
+
self.creds = {
"tenant": self.tenant_name,
"username": self.tenant_name,
"password": self.tenant_name,
- "auth_url": os_utils.get_credentials()['auth_url']
+ "auth_url": public_auth_url
}
self.prepare_images()
self.prepare_flavor()
@@ -356,7 +357,6 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding):
my_floating_ips = []
# Filter Floating IPs with tenant id
for floating_ip in floating_ips:
- # self.logger.info("Floating IP: %s", floating_ip)
if floating_ip.get('tenant_id') == tenant_id:
my_floating_ips.append(floating_ip.get('floating_ip_address'))
# Select if Floating IP exist else create new one
@@ -649,19 +649,19 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding):
port_name='%s_port' % self.case_name)
snaps_utils.neutron_utils.delete_port(neutron_client, port)
time.sleep(10)
- except Exception as exc:
+ except Exception as exc: # pylint: disable=broad-except
self.logger.error('Unexpected error cleaning - %s', exc)
try:
self.logger.info("Deleting Open Baton Floating IP...")
snaps_utils.neutron_utils.delete_floating_ip(
neutron_client, self.mano['details']['fip'])
- except Exception as exc:
+ except Exception as exc: # pylint: disable=broad-except
self.logger.error('Unexpected error cleaning - %s', exc)
for resource in reversed(self.created_resources):
try:
self.logger.info("Cleaning %s", str(resource))
resource.clean()
- except Exception as exc:
+ except Exception as exc: # pylint: disable=broad-except
self.logger.error('Unexpected error cleaning - %s', exc)
super(ClearwaterImsVnf, self).clean()
diff --git a/functest/opnfv_tests/vnf/ims/orchestra_openims.py b/functest/opnfv_tests/vnf/ims/orchestra_openims.py
index fcb65e73..d609a0fb 100644
--- a/functest/opnfv_tests/vnf/ims/orchestra_openims.py
+++ b/functest/opnfv_tests/vnf/ims/orchestra_openims.py
@@ -17,6 +17,12 @@ import time
import pkg_resources
import yaml
+import functest.core.vnf as vnf
+import functest.utils.openstack_utils as os_utils
+from functest.utils.constants import CONST
+
+from org.openbaton.cli.errors.errors import NfvoException
+from org.openbaton.cli.agents.agents import MainAgent
from snaps.config.flavor import FlavorConfig
from snaps.config.image import ImageConfig
from snaps.config.network import NetworkConfig, PortConfig, SubnetConfig
@@ -24,7 +30,7 @@ from snaps.config.router import RouterConfig
from snaps.config.security_group import (
Direction, Protocol, SecurityGroupConfig, SecurityGroupRuleConfig)
from snaps.config.vm_inst import VmInstanceConfig
-
+from snaps.openstack.utils import keystone_utils
from snaps.openstack.create_image import OpenStackImage
from snaps.openstack.create_flavor import OpenStackFlavor
from snaps.openstack.create_security_group import OpenStackSecurityGroup
@@ -34,13 +40,6 @@ from snaps.openstack.create_instance import OpenStackVmInstance
from functest.opnfv_tests.openstack.snaps import snaps_utils
-import functest.core.vnf as vnf
-import functest.utils.openstack_utils as os_utils
-from functest.utils.constants import CONST
-
-from org.openbaton.cli.errors.errors import NfvoException
-from org.openbaton.cli.agents.agents import MainAgent
-
__author__ = "Pauls, Michael <michael.pauls@fokus.fraunhofer.de>"
# ----------------------------------------------------------
@@ -202,12 +201,15 @@ class OpenImsVnf(vnf.VnfOnBoarding):
"""Prepare testscase (Additional pre-configuration steps)."""
super(OpenImsVnf, self).prepare()
+ public_auth_url = keystone_utils.get_endpoint(
+ self.snaps_creds, 'identity')
+
self.logger.info("Additional pre-configuration steps")
self.creds = {
"tenant": self.tenant_name,
"username": self.tenant_name,
"password": self.tenant_name,
- "auth_url": os_utils.get_credentials()['auth_url']
+ "auth_url": public_auth_url
}
self.prepare_images()
self.prepare_flavor()
@@ -659,8 +661,6 @@ class OpenImsVnf(vnf.VnfOnBoarding):
time.sleep(60)
else:
self.logger.info("No need to terminate the VNF...")
- # os_utils.delete_instance(nova_client=os_utils.get_nova_client(),
- # instance_id=self.mano_instance_id)
except (NfvoException, KeyError) as exc:
self.logger.error('Unexpected error cleaning - %s', exc)
@@ -672,13 +672,13 @@ class OpenImsVnf(vnf.VnfOnBoarding):
port_name='%s_port' % self.case_name)
snaps_utils.neutron_utils.delete_port(neutron_client, port)
time.sleep(10)
- except Exception as exc:
+ except Exception as exc: # pylint: disable=broad-except
self.logger.error('Unexpected error cleaning - %s', exc)
try:
self.logger.info("Deleting Open Baton Floating IP...")
snaps_utils.neutron_utils.delete_floating_ip(
neutron_client, self.mano['details']['fip'])
- except Exception as exc:
+ except Exception as exc: # pylint: disable=broad-except
self.logger.error('Unexpected error cleaning - %s', exc)
for resource in reversed(self.created_resources):