+ @BaseStep.store_state
+ def execute(self):
+ super().execute()
+ self._logger.info("Get existing SDNC service instance and update it over GR-API")
+ try:
+ service = Service.get(settings.SERVICE_ID)
+ service.service_status = settings.SERVICE_CHANGED_STATUS
+ service.service_data = settings.SERVICE_CHANGED_DATA
+ service.update()
+ self._logger.info("SDNC service update is completed.")
+ except APIError:
+ raise OnapTestException("SDNC service update is failed.")
+
+
+class UploadVfModulePreloadStep(BaseSdncStep):
+ """Upload preload information for VfModule.
+
+ Upload preload information for VfModule over GR-API.
+ """
+
+ def __init__(self, cleanup=False):
+ """Initialize step."""
+ super().__init__(cleanup=cleanup)
+
+ @property
+ def description(self) -> str:
+ """Step description.
+
+ Used for reports
+
+ Returns:
+ str: Step description
+
+ """
+ return "Upload Preload information for VfModule"
+
+ @BaseStep.store_state
+ def execute(self):
+ super().execute()
+ self._logger.info("Upload VfModule preload information over GR-API")
+ VfModulePreload.upload_vf_module_preload(
+ {
+ "vnf_name": settings.VNF_NAME,
+ "vnf_type": settings.VNF_TYPE
+ },
+ settings.VF_MODULE_NAME,
+ None
+ )
+
+
+class GetSdncPreloadStep(BaseSdncStep):
+ """Get preload information from SDNC.
+
+ Get preload information from SDNC over GR-API.
+ """
+
+ def __init__(self, cleanup=False):
+ """Initialize step.
+
+ Sub steps:
+ - UploadVfModulePreloadStep.
+ """
+ super().__init__(cleanup=cleanup)
+ self.add_step(UploadVfModulePreloadStep(cleanup=cleanup))
+
+ @property
+ def description(self) -> str:
+ """Step description.
+
+ Used for reports
+
+ Returns:
+ str: Step description
+
+ """
+ return "Get Preload information"
+
+ @BaseStep.store_state
+ def execute(self):
+ super().execute()
+ self._logger.info("Get existing SDNC service instance and update it over GR-API")
+ preloads = PreloadInformation.get_all()
+ for preload_information in preloads:
+ print(preload_information)
+
+
+class TestSdncStep(BaseStep):
+ """Top level step for SDNC tests."""
+
+ def __init__(self, cleanup=False):
+ """Initialize step.
+
+ Sub steps:
+ - UpdateSdncService.
+ """
+ super().__init__(cleanup=cleanup)
+ self.add_step(
+ UpdateSdncService(cleanup=cleanup)
+ )
+ self.add_step(
+ GetSdncPreloadStep(cleanup=cleanup)
+ )
+
+ @property
+ def description(self) -> str:
+ """Step description.
+
+ Used for reports
+
+ Returns:
+ str: Step description
+
+ """
+ return "Test SDNC functionality scenario step"
+