diff options
author | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2021-02-05 20:37:02 +0000 |
---|---|---|
committer | morganrol <morgan.richomme@orange.com> | 2021-02-08 18:12:38 +0100 |
commit | df5a03610d6f00ed8e8ee3e153de055fbc5dae94 (patch) | |
tree | 252a682d3932edd33301861c604abefb2191d8cd /src/onaptests/steps/instantiate | |
parent | 5021508f4b6f8bf2bb6ef890b4bb960dc144484b (diff) |
Python SDK 7.4.0 compatibility
Use Python SDK exceptions.
Issue-ID: TEST-302
Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Change-Id: I76996817c0d7b91c0214ad521c3768682ff07e83
Diffstat (limited to 'src/onaptests/steps/instantiate')
-rw-r--r-- | src/onaptests/steps/instantiate/k8s_profile_create.py | 5 | ||||
-rw-r--r-- | src/onaptests/steps/instantiate/service_ala_carte.py | 5 | ||||
-rw-r--r-- | src/onaptests/steps/instantiate/service_macro.py | 3 |
3 files changed, 8 insertions, 5 deletions
diff --git a/src/onaptests/steps/instantiate/k8s_profile_create.py b/src/onaptests/steps/instantiate/k8s_profile_create.py index a875f11..c2692c8 100644 --- a/src/onaptests/steps/instantiate/k8s_profile_create.py +++ b/src/onaptests/steps/instantiate/k8s_profile_create.py @@ -4,6 +4,7 @@ from yaml import load 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 @@ -142,7 +143,7 @@ class K8SProfileStep(BaseStep): ######## Check profile for Definition ################################### try: rbdef.get_profile_by_name(k8s_profile_name) - except ValueError: + except ResourceNotFound: ######## Create profile for Definition ################################### profile = rbdef.create_profile(k8s_profile_name, k8s_profile_namespace, @@ -174,7 +175,7 @@ class K8SProfileStep(BaseStep): try: profile = rbdef.get_profile_by_name(k8s_profile_name) profile.delete() - except ValueError: + except APIError: self._logger.error("K8s profile deletion %s failed", k8s_profile_name) raise onap_test_exceptions.ProfileCleanupException super().cleanup() diff --git a/src/onaptests/steps/instantiate/service_ala_carte.py b/src/onaptests/steps/instantiate/service_ala_carte.py index d5e5096..6000e73 100644 --- a/src/onaptests/steps/instantiate/service_ala_carte.py +++ b/src/onaptests/steps/instantiate/service_ala_carte.py @@ -6,6 +6,7 @@ from onapsdk.aai.cloud_infrastructure import CloudRegion, Tenant from onapsdk.aai.business import Customer, ServiceInstance, ServiceSubscription from onapsdk.aai.business.owning_entity import OwningEntity as AaiOwningEntity 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 @@ -66,7 +67,7 @@ class ServiceAlaCarteInstantiateStep(BaseStep): try: owning_entity = AaiOwningEntity.get_by_owning_entity_name( settings.OWNING_ENTITY) - except ValueError: + except ResourceNotFound: self._logger.info("Owning entity not found, create it") owning_entity = AaiOwningEntity.create(settings.OWNING_ENTITY) vid_project = Project.create(settings.PROJECT) @@ -187,7 +188,7 @@ class YamlTemplateServiceAlaCarteInstantiateStep(YamlTemplateBaseStep): try: owning_entity = AaiOwningEntity.get_by_owning_entity_name( settings.OWNING_ENTITY) - except ValueError: + except ResourceNotFound: self._logger.info("Owning entity not found, create it") owning_entity = AaiOwningEntity.create(settings.OWNING_ENTITY) vid_project = Project.create(settings.PROJECT) diff --git a/src/onaptests/steps/instantiate/service_macro.py b/src/onaptests/steps/instantiate/service_macro.py index 36f0130..04c3931 100644 --- a/src/onaptests/steps/instantiate/service_macro.py +++ b/src/onaptests/steps/instantiate/service_macro.py @@ -9,6 +9,7 @@ from onapsdk.aai.business.owning_entity import OwningEntity from onapsdk.aai.cloud_infrastructure.cloud_region import CloudRegion from onapsdk.aai.cloud_infrastructure.tenant import Tenant 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 LineOfBusiness, Platform, Project @@ -137,7 +138,7 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep): try: owning_entity = OwningEntity.get_by_owning_entity_name( settings.OWNING_ENTITY) - except ValueError: + except ResourceNotFound: self._logger.info("Owning entity not found, create it") owning_entity = OwningEntity.create(settings.OWNING_ENTITY) vid_project: Project = Project(settings.PROJECT) |