diff options
Diffstat (limited to 'functest')
-rw-r--r-- | functest/core/pytest_suite_runner.py | 4 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/rally/rally.py | 10 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/snaps/api_check.py | 5 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/snaps/connection_check.py | 5 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/snaps/health_check.py | 5 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/snaps/snaps_test_runner.py | 4 | ||||
-rwxr-xr-x | functest/opnfv_tests/vnf/ims/orchestra_ims.py | 62 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/orchestra_ims.yaml | 2 |
8 files changed, 66 insertions, 31 deletions
diff --git a/functest/core/pytest_suite_runner.py b/functest/core/pytest_suite_runner.py index 4f777628..9cfaea7a 100644 --- a/functest/core/pytest_suite_runner.py +++ b/functest/core/pytest_suite_runner.py @@ -15,8 +15,8 @@ class PyTestSuiteRunner(base.TestCase): This superclass is designed to execute pre-configured unittest.TestSuite() objects """ - def __init__(self): - super(PyTestSuiteRunner, self).__init__() + def __init__(self, case_name=''): + super(PyTestSuiteRunner, self).__init__(case_name) self.suite = None def run(self, **kwargs): diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 1fe6143e..e7411c51 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -536,9 +536,8 @@ class RallyBase(testcase.TestCase): class RallySanity(RallyBase): - def __init__(self): - super(RallySanity, self).__init__() - self.case_name = 'rally_sanity' + def __init__(self, case_name="rally_sanity"): + super(RallySanity, self).__init__(case_name) self.mode = 'sanity' self.test_name = 'all' self.smoke = True @@ -546,9 +545,8 @@ class RallySanity(RallyBase): class RallyFull(RallyBase): - def __init__(self): - super(RallyFull, self).__init__() - self.case_name = 'rally_full' + def __init__(self, case_name="rally_full"): + super(RallyFull, self).__init__(case_name) self.mode = 'full' self.test_name = 'all' self.smoke = False diff --git a/functest/opnfv_tests/openstack/snaps/api_check.py b/functest/opnfv_tests/openstack/snaps/api_check.py index ad77d9be..dea1ca75 100644 --- a/functest/opnfv_tests/openstack/snaps/api_check.py +++ b/functest/opnfv_tests/openstack/snaps/api_check.py @@ -20,11 +20,10 @@ class ApiCheck(SnapsTestRunner): that exercise many of the OpenStack APIs within Keystone, Glance, Neutron, and Nova """ - def __init__(self): - super(ApiCheck, self).__init__() + def __init__(self, case_name="api_check"): + super(ApiCheck, self).__init__(case_name) self.suite = unittest.TestSuite() - self.case_name = "api_check" test_suite_builder.add_openstack_api_tests( self.suite, diff --git a/functest/opnfv_tests/openstack/snaps/connection_check.py b/functest/opnfv_tests/openstack/snaps/connection_check.py index 0637bcfb..57b74d4c 100644 --- a/functest/opnfv_tests/openstack/snaps/connection_check.py +++ b/functest/opnfv_tests/openstack/snaps/connection_check.py @@ -20,11 +20,10 @@ class ConnectionCheck(SnapsTestRunner): that simply obtain the different OpenStack clients and may perform simple queries """ - def __init__(self): - super(ConnectionCheck, self).__init__() + def __init__(self, case_name="connection_check"): + super(ConnectionCheck, self).__init__(case_name) self.suite = unittest.TestSuite() - self.case_name = "connection_check" test_suite_builder.add_openstack_client_tests( self.suite, diff --git a/functest/opnfv_tests/openstack/snaps/health_check.py b/functest/opnfv_tests/openstack/snaps/health_check.py index 8fece746..6b3cfdd0 100644 --- a/functest/opnfv_tests/openstack/snaps/health_check.py +++ b/functest/opnfv_tests/openstack/snaps/health_check.py @@ -21,11 +21,10 @@ class HealthCheck(SnapsTestRunner): creates a VM with a single port with an IPv4 address that is assigned by DHCP. This test then validates the expected IP with the actual """ - def __init__(self): - super(HealthCheck, self).__init__() + def __init__(self, case_name="snaps_health_check"): + super(HealthCheck, self).__init__(case_name) self.suite = unittest.TestSuite() - self.case_name = "snaps_health_check" image_custom_config = None if hasattr(CONST, 'snaps_health_check'): diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py index 9d723905..044a0bb0 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py @@ -19,8 +19,8 @@ class SnapsTestRunner(PyTestSuiteRunner): creates a VM with a single port with an IPv4 address that is assigned by DHCP. This test then validates the expected IP with the actual """ - def __init__(self): - super(SnapsTestRunner, self).__init__() + def __init__(self, case_name=''): + super(SnapsTestRunner, self).__init__(case_name) self.ext_net_name = snaps_utils.get_ext_net_name() self.logger = ft_logger.Logger(self.project_name).getLogger() diff --git a/functest/opnfv_tests/vnf/ims/orchestra_ims.py b/functest/opnfv_tests/vnf/ims/orchestra_ims.py index 213d690d..c95a17e2 100755 --- a/functest/opnfv_tests/vnf/ims/orchestra_ims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_ims.py @@ -103,7 +103,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): try: self.config = CONST.__getattribute__( 'vnf_{}_config'.format(self.case_name)) - except: + except BaseException: raise Exception("Orchestra VNF config file not found") config_file = self.case_dir + self.config self.imagename = get_config("openbaton.imagename", config_file) @@ -115,6 +115,8 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): config_file) self.images = get_config("tenant_images", config_file) self.ims_conf = get_config("vIMS", config_file) + self.userdata_file = get_config("openbaton.userdata.file", + config_file) def deploy_orchestrator(self, **kwargs): self.logger.info("Additional pre-configuration steps") @@ -132,7 +134,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): image_id = os_utils.get_image_id(glance_client, image_name) self.logger.info("image_id: %s" % image_id) - except: + except BaseException: self.logger.error("Unexpected error: %s" % sys.exc_info()[0]) if image_id == '': @@ -153,7 +155,8 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): "192.168.100.0/24") # orchestrator VM flavor - self.logger.info("Check if Flavor is available, if not create one") + self.logger.info( + "Check if orchestra Flavor is available, if not create one") flavor_exist, flavor_id = os_utils.get_or_create_flavor( "orchestra", "4096", @@ -210,8 +213,13 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): bootstrap = "sh ./bootstrap release -configFile=./config_file" userdata += bootstrap + "\n" userdata += "echo \"Setting 'nfvo.plugin.timeout' to '300000'\"\n" - userdata += ("echo \"nfvo.plugin.timeout=300000\" >> " + userdata += ("echo \"nfvo.plugin.timeout=600000\" >> " "/etc/openbaton/openbaton-nfvo.properties\n") + userdata += ( + "wget %s -O /etc/openbaton/openbaton-vnfm-generic-user-data.sh\n" % + self.userdata_file) + userdata += "sed -i '113i\ \ \ \ sleep 60' " \ + "/etc/openbaton/openbaton-vnfm-generic-user-data.sh\n" userdata += "echo \"Starting NFVO\"\n" userdata += "service openbaton-nfvo restart\n" userdata += "echo \"Starting Generic VNFM\"\n" @@ -283,7 +291,10 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): self.ob_username = "admin" self.ob_https = False self.ob_port = "8080" - + self.logger.info("Waiting for all components up and running...") + time.sleep(60) + self.details["orchestrator"] = { + 'status': "PASS", 'result': "Deploy Open Baton NFVO: OK"} self.logger.info("Deploy Open Baton NFVO: OK") def deploy_vnf(self): @@ -296,6 +307,16 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): username=self.ob_username, password=self.ob_password) + self.logger.info( + "Check if openims Flavor is available, if not create one") + flavor_exist, flavor_id = os_utils.get_or_create_flavor( + "m1.small", + "2048", + '20', + '1', + public=True) + self.logger.debug("Flavor id: %s" % flavor_id) + self.logger.info("Getting project 'default'...") project_agent = self.main_agent.get_agent("project", self.ob_projectid) for p in json.loads(project_agent.find()): @@ -311,9 +332,16 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): creds = os_utils.get_credentials() self.logger.info("PoP creds: %s" % creds) - project_id = os_utils.get_tenant_id( - os_utils.get_keystone_client(), - creds.get("project_name")) + if os_utils.is_keystone_v3(): + self.logger.info( + "Using v3 API of OpenStack... -> Using OS_PROJECT_ID") + project_id = os_utils.get_tenant_id( + os_utils.get_keystone_client(), + creds.get("project_name")) + else: + self.logger.info( + "Using v2 API of OpenStack... -> Using OS_TENANT_NAME") + project_id = creds.get("tenant_name") self.logger.debug("project id: %s" % project_id) @@ -381,16 +409,17 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): self.nsr = json.loads(nsr_agent.find(self.nsr.get('id'))) if self.nsr.get("status") == 'ACTIVE': - deploy_vnf = {'status': "PASS", 'result': self.nsr} + self.details["vnf"] = {'status': "PASS", 'result': self.nsr} self.logger.info("Deploy VNF: OK") else: - deploy_vnf = {'status': "FAIL", 'result': self.nsr} + self.details["vnf"] = {'status': "FAIL", 'result': self.nsr} + self.logger.error(self.nsr) self.step_failure("Deploy VNF: ERROR") self.ob_nsr_id = self.nsr.get("id") self.logger.info( "Sleep for 60s to ensure that all services are up and running...") time.sleep(60) - return deploy_vnf + return self.details.get("vnf") def test_vnf(self): # Adaptations probably needed @@ -427,9 +456,18 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): "VNFC instance %s is not reachable " "at %s:%s" % (vnfci.get('hostname'), floatingIp.get('ip'), port)) + self.details["test_vnf"] = { + 'status': "FAIL", 'result': ( + "Port %s of server %s -> %s is " + "not reachable" % + (port, vnfci.get('hostname'), + floatingIp.get('ip')))} self.step_failure("Test VNF: ERROR") + self.details["test_vnf"] = { + 'status': "PASS", + 'result': "All tests have been executed successfully"} self.logger.info("Test VNF: OK") - return + return self.details.get('test_vnf') def clean(self): self.main_agent.get_agent( diff --git a/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml b/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml index 5923a775..5b25d3c9 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml +++ b/functest/opnfv_tests/vnf/ims/orchestra_ims.yaml @@ -4,6 +4,8 @@ tenant_images: openbaton: bootstrap_link: http://get.openbaton.org/bootstraps/bootstrap_3.2.0_opnfv/bootstrap bootstrap_config_link: http://get.openbaton.org/bootstraps/bootstrap_3.2.0_opnfv/bootstrap-config-file + userdata: + file: https://raw.githubusercontent.com/openbaton/generic-vnfm/3.2.0/src/main/resources/user-data.sh marketplace_link: http://marketplace.openbaton.org:8082/api/v1/nsds/fokus/OpenImsCore/3.2.0/json imagename: ubuntu_14.04 vIMS: |