diff options
author | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2021-10-13 09:28:45 +0000 |
---|---|---|
committer | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2021-10-17 07:25:38 +0000 |
commit | 062f7ed7f73ed61dc3990c3a23403fd544ae6261 (patch) | |
tree | 37c6d7a4ad1ae85bf4e89ef6300a8632ed89b20b /src/onaptests/steps/instantiate | |
parent | 3a93d05df6e61d25d2383658adac87c8ef34a168 (diff) |
[INTEGRATION] Use the newest onapsdk (9.0.0)
Issue-ID: INT-1994
Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Change-Id: I3b6e04f5c89265f16674a66317faddee4c9597ab
Diffstat (limited to 'src/onaptests/steps/instantiate')
6 files changed, 19 insertions, 32 deletions
diff --git a/src/onaptests/steps/instantiate/k8s_profile_create.py b/src/onaptests/steps/instantiate/k8s_profile_create.py index fab61a4..d09d924 100644 --- a/src/onaptests/steps/instantiate/k8s_profile_create.py +++ b/src/onaptests/steps/instantiate/k8s_profile_create.py @@ -6,7 +6,7 @@ from onapsdk.aai.business import Customer, ServiceInstance, ServiceSubscription from onapsdk.configuration import settings from onapsdk.exceptions import APIError, ResourceNotFound from onapsdk.msb.k8s import Definition -from onapsdk.so.instantiation import VnfParameter +from onapsdk.so.instantiation import InstantiationParameter import onaptests.utils.exceptions as onap_test_exceptions from ..base import BaseStep @@ -83,14 +83,14 @@ class K8SProfileStep(BaseStep): return self._service_instance_name return self.parent.service_instance_name - def get_vnf_parameters(self, vnf_name: str) -> Iterable[VnfParameter]: + def get_vnf_parameters(self, vnf_name: str) -> Iterable[InstantiationParameter]: """Get VNF parameters from YAML template. Args: vnf_name (str): VNF name to get parameters for. Yields: - Iterator[Iterable[VnfParameter]]: VNF parameter + Iterator[Iterable[InstantiationParameter]]: VNF parameter """ @@ -99,7 +99,7 @@ class K8SProfileStep(BaseStep): for vnf in self.yaml_template[self.service_name]["vnfs"]: if vnf["vnf_name"] == vnf_name: for vnf_parameter in vnf["vnf_parameters"]: - yield VnfParameter( + yield InstantiationParameter( name=vnf_parameter["name"], value=vnf_parameter["value"] ) diff --git a/src/onaptests/steps/instantiate/service_ala_carte.py b/src/onaptests/steps/instantiate/service_ala_carte.py index 4274a9f..dd62f52 100644 --- a/src/onaptests/steps/instantiate/service_ala_carte.py +++ b/src/onaptests/steps/instantiate/service_ala_carte.py @@ -9,7 +9,6 @@ from onapsdk.configuration import settings from onapsdk.exceptions import ResourceNotFound from onapsdk.sdc.service import Service from onapsdk.so.instantiation import ServiceInstantiation -from onapsdk.vid import Project import onaptests.utils.exceptions as onap_test_exceptions from ..base import BaseStep, YamlTemplateBaseStep @@ -70,15 +69,14 @@ class ServiceAlaCarteInstantiateStep(BaseStep): except ResourceNotFound: self._logger.info("Owning entity not found, create it") owning_entity = AaiOwningEntity.create(settings.OWNING_ENTITY) - vid_project = Project(settings.PROJECT) - service_instantiation = ServiceInstantiation.instantiate_so_ala_carte( + service_instantiation = ServiceInstantiation.instantiate_ala_carte( service, cloud_region, tenant, customer, owning_entity, - vid_project, + settings.PROJECT, service_instance_name=settings.SERVICE_INSTANCE_NAME ) try: @@ -197,7 +195,6 @@ class YamlTemplateServiceAlaCarteInstantiateStep(YamlTemplateBaseStep): except ResourceNotFound: self._logger.info("Owning entity not found, create it") owning_entity = AaiOwningEntity.create(settings.OWNING_ENTITY) - vid_project = Project(settings.PROJECT) # Before instantiating, be sure that the service has been distributed self._logger.info("******** Check Service Distribution *******") @@ -222,13 +219,13 @@ class YamlTemplateServiceAlaCarteInstantiateStep(YamlTemplateBaseStep): "Service Distribution for %s failed !!",service.name) raise onap_test_exceptions.ServiceDistributionException - service_instantiation = ServiceInstantiation.instantiate_so_ala_carte( + service_instantiation = ServiceInstantiation.instantiate_ala_carte( service, cloud_region, tenant, customer, owning_entity, - vid_project, + settings.PROJECT, service_instance_name=self.service_instance_name ) try: diff --git a/src/onaptests/steps/instantiate/service_macro.py b/src/onaptests/steps/instantiate/service_macro.py index 7ed4952..d83d2fe 100644 --- a/src/onaptests/steps/instantiate/service_macro.py +++ b/src/onaptests/steps/instantiate/service_macro.py @@ -13,7 +13,6 @@ from onapsdk.configuration import settings from onapsdk.exceptions import ResourceNotFound from onapsdk.sdc.service import Service from onapsdk.so.instantiation import InstantiationParameter, ServiceInstantiation, VfmoduleParameters, VnfParameters -from onapsdk.vid import LineOfBusiness, Platform, Project from onaptests.steps.cloud.customer_service_subscription_create import CustomerServiceSubscriptionCreateStep import onaptests.utils.exceptions as onap_test_exceptions @@ -143,9 +142,6 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep): except ResourceNotFound: self._logger.info("Owning entity not found, create it") owning_entity = OwningEntity.create(settings.OWNING_ENTITY) - vid_project: Project = Project(settings.PROJECT) - line_of_business: LineOfBusiness = LineOfBusiness(settings.LINE_OF_BUSINESS) - platform: Platform = Platform(settings.PLATFORM) # Before instantiating, be sure that the service has been distributed self._logger.info("******** Check Service Distribution *******") @@ -184,9 +180,9 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep): service, customer=customer, owning_entity=owning_entity, - project=vid_project, - line_of_business=line_of_business, - platform=platform, + project=settings.PROJECT, + line_of_business=settings.LINE_OF_BUSINESS, + platform=settings.PLATFORM, cloud_region=cloud_region, tenant=tenant, service_instance_name=self.service_instance_name, diff --git a/src/onaptests/steps/instantiate/vf_module_ala_carte.py b/src/onaptests/steps/instantiate/vf_module_ala_carte.py index 65559ca..aacecc3 100644 --- a/src/onaptests/steps/instantiate/vf_module_ala_carte.py +++ b/src/onaptests/steps/instantiate/vf_module_ala_carte.py @@ -5,7 +5,7 @@ from yaml import load from onapsdk.aai.cloud_infrastructure import CloudRegion, Tenant from onapsdk.aai.business import Customer, ServiceInstance, ServiceSubscription from onapsdk.configuration import settings -from onapsdk.so.instantiation import VnfParameter +from onapsdk.so.instantiation import InstantiationParameter import onaptests.utils.exceptions as onap_test_exceptions from ..base import YamlTemplateBaseStep @@ -91,14 +91,14 @@ class YamlTemplateVfModuleAlaCarteInstantiateStep(YamlTemplateBaseStep): return self._service_instance_name return self.parent.service_instance_name - def get_vnf_parameters(self, vnf_name: str) -> Iterable[VnfParameter]: + def get_vnf_parameters(self, vnf_name: str) -> Iterable[InstantiationParameter]: """Get VNF parameters from YAML template. Args: vnf_name (str): VNF name to get parameters for. Yields: - Iterator[Iterable[VnfParameter]]: VNF parameter + Iterator[Iterable[InstantiationParameter]]: VNF parameter """ @@ -107,7 +107,7 @@ class YamlTemplateVfModuleAlaCarteInstantiateStep(YamlTemplateBaseStep): for vnf in self.yaml_template[self.service_name]["vnfs"]: if vnf["vnf_name"] == vnf_name: for vnf_parameter in vnf["vnf_parameters"]: - yield VnfParameter( + yield InstantiationParameter( name=vnf_parameter["name"], value=vnf_parameter["value"] ) diff --git a/src/onaptests/steps/instantiate/vl_ala_carte.py b/src/onaptests/steps/instantiate/vl_ala_carte.py index 75dcdb9..3bb293a 100644 --- a/src/onaptests/steps/instantiate/vl_ala_carte.py +++ b/src/onaptests/steps/instantiate/vl_ala_carte.py @@ -7,7 +7,6 @@ from onapsdk.aai.business import Customer, ServiceInstance, ServiceSubscription from onapsdk.configuration import settings from onapsdk.so.instantiation import Subnet from onapsdk.sdc.service import Service -from onapsdk.vid import LineOfBusiness, Platform import onaptests.utils.exceptions as onap_test_exceptions from ..base import YamlTemplateBaseStep @@ -130,14 +129,12 @@ class YamlTemplateVlAlaCarteInstantiateStep(YamlTemplateBaseStep): service_subscription: ServiceSubscription = customer.get_service_subscription_by_service_type(self.service_name) service_instance: ServiceInstance = service_subscription.get_service_instance_by_name(self.service_instance_name) self._service_instance = service_instance - line_of_business: LineOfBusiness = LineOfBusiness(settings.LINE_OF_BUSINESS) - platform: Platform = Platform(settings.PLATFORM) for idx, network in enumerate(service.networks): #for network in self.yaml_template[self.service_name]["networks"]: net_instantiation = service_instance.add_network( network, - line_of_business, - platform, + settings.LINE_OF_BUSINESS, + settings.PLATFORM, network_instance_name=f"{self.service_instance_name}_net_{idx}", subnets=self.get_subnets(network.name)) try: diff --git a/src/onaptests/steps/instantiate/vnf_ala_carte.py b/src/onaptests/steps/instantiate/vnf_ala_carte.py index c97add5..b02c7ea 100644 --- a/src/onaptests/steps/instantiate/vnf_ala_carte.py +++ b/src/onaptests/steps/instantiate/vnf_ala_carte.py @@ -5,7 +5,6 @@ from onapsdk.aai.cloud_infrastructure import CloudRegion, Tenant from onapsdk.aai.business import Customer, ServiceInstance, ServiceSubscription from onapsdk.configuration import settings from onapsdk.sdc.service import Service -from onapsdk.vid import LineOfBusiness, Platform import onaptests.utils.exceptions as onap_test_exceptions from ..base import YamlTemplateBaseStep @@ -102,8 +101,6 @@ class YamlTemplateVnfAlaCarteInstantiateStep(YamlTemplateBaseStep): customer: Customer = Customer.get_by_global_customer_id(settings.GLOBAL_CUSTOMER_ID) service_subscription: ServiceSubscription = customer.get_service_subscription_by_service_type(self.service_name) self._service_instance: ServiceInstance = service_subscription.get_service_instance_by_name(self.service_instance_name) - line_of_business: LineOfBusiness = LineOfBusiness(settings.LINE_OF_BUSINESS) - platform: Platform = Platform(settings.PLATFORM) cloud_region: CloudRegion = CloudRegion.get_by_id( cloud_owner=settings.CLOUD_REGION_CLOUD_OWNER, cloud_region_id=settings.CLOUD_REGION_ID, @@ -112,8 +109,8 @@ class YamlTemplateVnfAlaCarteInstantiateStep(YamlTemplateBaseStep): for idx, vnf in enumerate(service.vnfs): vnf_instantiation = self._service_instance.add_vnf( vnf, - line_of_business, - platform, + settings.LINE_OF_BUSINESS, + settings.PLATFORM, cloud_region, tenant, f"{self.service_instance_name}_vnf_{idx}") |