From 578f831fe90f08028c6e88e103175b9bb698b6c5 Mon Sep 17 00:00:00 2001 From: boucherv Date: Tue, 22 Aug 2017 12:08:14 +0200 Subject: More support of snaps for VNF Remove OpenStack utils in vnf_base Support snaps for quotas management in cloudify_ims Change-Id: I44e5b01bb26569276133e85dfc25bc2cceb03056 Signed-off-by: boucherv --- functest/opnfv_tests/vnf/ims/cloudify_ims.py | 27 +++++++++++----------- functest/opnfv_tests/vnf/ims/cloudify_ims.yaml | 7 ++++++ .../opnfv_tests/vnf/ims/orchestra_clearwaterims.py | 15 +++++------- functest/opnfv_tests/vnf/ims/orchestra_openims.py | 17 +++++--------- 4 files changed, 32 insertions(+), 34 deletions(-) (limited to 'functest/opnfv_tests/vnf') diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py index 8f6fcec8..2733bc3a 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py @@ -24,7 +24,6 @@ import functest.opnfv_tests.vnf.ims.clearwater_ims_base as clearwater_ims_base from functest.utils.constants import CONST import functest.utils.openstack_utils as os_utils -from snaps.openstack.os_credentials import OSCreds from snaps.openstack.create_network import (NetworkSettings, SubnetSettings, OpenStackNetwork) from snaps.openstack.create_security_group import (SecurityGroupSettings, @@ -63,7 +62,6 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): raise Exception("VNF config file not found") self.snaps_creds = '' - self.created_object = [] config_file = os.path.join(self.case_dir, self.config) self.orchestrator = dict( @@ -101,12 +99,19 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): self.__logger.info("Additional pre-configuration steps") - self.snaps_creds = OSCreds( - username=self.creds['username'], - password=self.creds['password'], - auth_url=self.creds['auth_url'], - project_name=self.creds['tenant'], - identity_api_version=int(os_utils.get_keystone_client_version())) + compute_quotas = self.os_project.get_compute_quotas() + network_quotas = self.os_project.get_network_quotas() + + for key, value in ( + self.orchestrator['requirements']['compute_quotas'].items()): + setattr(compute_quotas, key, value) + + for key, value in ( + self.orchestrator['requirements']['network_quotas'].items()): + setattr(network_quotas, key, value) + + compute_quotas = self.project_ims.update_compute_quotas(compute_quotas) + network_quotas = self.project_ims.update_network_quotas(network_quotas) # needs some images self.__logger.info("Upload some OS images if it doesn't exist") @@ -392,12 +397,6 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): self.__logger.warn("Some issue during the undeployment ..") self.__logger.warn("Tenant clean continue ..") - self.__logger.info('Remove the cloudify manager OS object ..') - for creator in reversed(self.created_object): - try: - creator.clean() - except Exception as exc: - self.logger.error('Unexpected error cleaning - %s', exc) super(CloudifyIms, self).clean() @energy.enable_recording diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml b/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml index 743c6ddd..1b239468 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml @@ -21,6 +21,13 @@ vnf: flavor: name: m1.small ram_min: 2048 + compute_quotas: + cores: 50 + instances: 15 + network_quotas: + security_group: 20 + security_group_rule: 100 + port: 50 inputs: image_id: 'ubuntu_14.04' flavor_id: 'm1.small' diff --git a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py index 9e14711c..c1b88c66 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py @@ -31,7 +31,6 @@ from snaps.openstack.create_network import ( SubnetSettings, PortSettings) from snaps.openstack.create_router import OpenStackRouter, RouterSettings -from snaps.openstack.os_credentials import OSCreds from snaps.openstack.create_instance import ( VmInstanceSettings, OpenStackVmInstance) @@ -210,15 +209,13 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): super(ClearwaterImsVnf, self).prepare() self.logger.info("Additional pre-configuration steps") - self.logger.info("creds %s", (self.creds)) - - self.snaps_creds = OSCreds( - username=self.creds['username'], - password=self.creds['password'], - auth_url=self.creds['auth_url'], - project_name=self.creds['tenant'], - identity_api_version=int(os_utils.get_keystone_client_version())) + self.creds = { + "tenant": self.tenant_name, + "username": self.tenant_name, + "password": self.tenant_name, + "auth_url": os_utils.get_credentials()['auth_url'] + } self.prepare_images() self.prepare_flavor() self.prepare_security_groups() diff --git a/functest/opnfv_tests/vnf/ims/orchestra_openims.py b/functest/opnfv_tests/vnf/ims/orchestra_openims.py index f9a81f22..d9d4d8a1 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_openims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_openims.py @@ -32,7 +32,6 @@ from snaps.openstack.create_network import ( SubnetSettings, PortSettings) from snaps.openstack.create_router import OpenStackRouter, RouterSettings -from snaps.openstack.os_credentials import OSCreds from snaps.openstack.create_instance import ( VmInstanceSettings, OpenStackVmInstance) from functest.opnfv_tests.openstack.snaps import snaps_utils @@ -199,22 +198,18 @@ class OpenImsVnf(vnf.VnfOnBoarding): self.case_name, config_file) self.images.update(get_config("tenant_images.%s" % self.case_name, config_file)) - self.snaps_creds = None def prepare(self): """Prepare testscase (Additional pre-configuration steps).""" super(OpenImsVnf, self).prepare() self.logger.info("Additional pre-configuration steps") - self.logger.info("creds %s", (self.creds)) - - self.snaps_creds = OSCreds( - username=self.creds['username'], - password=self.creds['password'], - auth_url=self.creds['auth_url'], - project_name=self.creds['tenant'], - identity_api_version=int(os_utils.get_keystone_client_version())) - + self.creds = { + "tenant": self.tenant_name, + "username": self.tenant_name, + "password": self.tenant_name, + "auth_url": os_utils.get_credentials()['auth_url'] + } self.prepare_images() self.prepare_flavor() self.prepare_security_groups() -- cgit 1.2.3-korg