diff options
Diffstat (limited to 'src/onaptests/steps/cloud')
3 files changed, 43 insertions, 1 deletions
diff --git a/src/onaptests/steps/cloud/connect_service_subscription_to_cloud_region.py b/src/onaptests/steps/cloud/connect_service_subscription_to_cloud_region.py index 636f8cd..d48ff7c 100644 --- a/src/onaptests/steps/cloud/connect_service_subscription_to_cloud_region.py +++ b/src/onaptests/steps/cloud/connect_service_subscription_to_cloud_region.py @@ -6,6 +6,7 @@ from ..base import BaseStep from .customer_service_subscription_create import CustomerServiceSubscriptionCreateStep from .link_cloud_to_complex import LinkCloudRegionToComplexStep from .register_cloud import RegisterCloudRegionStep +from .k8s_connectivity_info_create import K8SConnectivityInfoStep class ConnectServiceSubToCloudRegionStep(BaseStep): @@ -21,6 +22,8 @@ class ConnectServiceSubToCloudRegionStep(BaseStep): """ super().__init__(cleanup=cleanup) + if settings.CLOUD_REGION_TYPE == "k8s": + self.add_step(K8SConnectivityInfoStep(cleanup=cleanup)) self.add_step(RegisterCloudRegionStep(cleanup=cleanup)) self.add_step(LinkCloudRegionToComplexStep(cleanup=cleanup)) self.add_step(CustomerServiceSubscriptionCreateStep(cleanup=cleanup)) diff --git a/src/onaptests/steps/cloud/k8s_connectivity_info_create.py b/src/onaptests/steps/cloud/k8s_connectivity_info_create.py new file mode 100644 index 0000000..ef95876 --- /dev/null +++ b/src/onaptests/steps/cloud/k8s_connectivity_info_create.py @@ -0,0 +1,33 @@ +from onapsdk.configuration import settings +from onapsdk.msb.k8s import ConnectivityInfo + +from ..base import BaseStep + +class K8SConnectivityInfoStep(BaseStep): + """CreateConnnectivityInfoStep.""" + + @BaseStep.store_state + def execute(self): + """Creation k8s connectivity information + + Use settings values: + - CLOUD_REGION_ID, + - CLOUD_REGION_CLOUD_OWNER, + - K8S_KUBECONFIG_FILE. + """ + super().execute() + ######## Create Connectivity Info ######################################### + try: + ConnectivityInfo.get_connectivity_info_by_region_id(settings.CLOUD_REGION_ID) + except ValueError: + ConnectivityInfo.create(settings.CLOUD_REGION_ID, + settings.CLOUD_REGION_CLOUD_OWNER, + open(settings.K8S_KUBECONFIG_FILE, 'rb').read()) + + def cleanup(self) -> None: + """Cleanup K8S Connectivity information. + """ + self._logger.info("*Clean the k8s connectivity information *") + super().cleanup() + connectinfo = ConnectivityInfo.get_connectivity_info_by_region_id(settings.CLOUD_REGION_ID) + connectinfo.delete() diff --git a/src/onaptests/steps/cloud/register_cloud.py b/src/onaptests/steps/cloud/register_cloud.py index 6836b12..0ab0dfb 100644 --- a/src/onaptests/steps/cloud/register_cloud.py +++ b/src/onaptests/steps/cloud/register_cloud.py @@ -18,6 +18,9 @@ class RegisterCloudRegionStep(BaseStep): - CLOUD_REGION_CLOUD_OWNER, - CLOUD_REGION_ID, - CLOUD_DOMAIN, + - CLOUD_REGION_VERSION, + - CLOUD_OWNER_DEFINED_TYPE, + - COMPLEX_PHYSICAL_LOCATION_ID, - VIM_USERNAME, - VIM_PASSWORD, - VIM_SERVICE_URL, @@ -38,7 +41,10 @@ class RegisterCloudRegionStep(BaseStep): orchestration_disabled=False, in_maint=False, cloud_type=settings.CLOUD_REGION_TYPE, - cloud_region_version=settings.CLOUD_REGION_VERSION + cloud_region_version=settings.CLOUD_REGION_VERSION, + owner_defined_type=settings.CLOUD_OWNER_DEFINED_TYPE, + complex_name=settings.COMPLEX_PHYSICAL_LOCATION_ID + # cloud_extra_info=settings.CLOUD_EXTRA_INFO ) cloud_region.add_esr_system_info( esr_system_info_id=str(uuid4()), |