From 5a6a6de6f1a26a1897e4917a0df613e25a24eb70 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Mon, 30 Jul 2018 15:56:09 -0400 Subject: Containerization feature of SO Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) --- .../org/openecomp/mso/apihandlerinfra/Action.java | 42 - .../openecomp/mso/apihandlerinfra/Constants.java | 48 - .../mso/apihandlerinfra/E2EServiceInstances.java | 1189 ------------------- .../apihandlerinfra/GlobalHealthcheckHandler.java | 66 -- .../mso/apihandlerinfra/HealthcheckHandler.java | 66 -- .../openecomp/mso/apihandlerinfra/InfraUtils.java | 43 - .../openecomp/mso/apihandlerinfra/ManualTasks.java | 227 ---- .../openecomp/mso/apihandlerinfra/Messages.java | 56 - .../openecomp/mso/apihandlerinfra/ModelType.java | 32 - .../mso/apihandlerinfra/MsoException.java | 26 - .../mso/apihandlerinfra/MsoPropertiesUtils.java | 57 - .../openecomp/mso/apihandlerinfra/MsoRequest.java | 1186 ------------------- .../apihandlerinfra/NodeHealthcheckHandler.java | 64 - .../mso/apihandlerinfra/OrchestrationRequests.java | 376 ------ .../mso/apihandlerinfra/RecipeLookupResult.java | 76 -- .../mso/apihandlerinfra/RequestActionMap.java | 53 - .../mso/apihandlerinfra/ServiceInstances.java | 1249 -------------------- .../org/openecomp/mso/apihandlerinfra/Status.java | 34 - .../mso/apihandlerinfra/TasksHandler.java | 327 ----- .../CompareModelsRequest.java | 68 -- .../e2eserviceinstancebeans/DelE2ESvcResp.java | 37 - .../e2eserviceinstancebeans/E2EParameters.java | 83 -- .../e2eserviceinstancebeans/E2ERequest.java | 113 -- .../e2eserviceinstancebeans/E2EService.java | 120 -- .../E2EServiceInstanceDeleteRequest.java | 46 - .../E2EServiceInstanceRequest.java | 61 - .../E2EServiceInstanceScaleRequest.java | 35 - .../e2eserviceinstancebeans/E2EUserParam.java | 69 -- .../GetE2EServiceInstanceResponse.java | 48 - .../LocationConstraint.java | 76 -- .../e2eserviceinstancebeans/NsParameters.java | 68 -- .../e2eserviceinstancebeans/ResourceRequest.java | 102 -- .../ScaleNsByStepsData.java | 54 - .../e2eserviceinstancebeans/ScaleNsData.java | 34 - .../e2eserviceinstancebeans/ScaleResource.java | 54 - .../e2eserviceinstancebeans/ScaleService.java | 66 -- .../e2eserviceinstancebeans/VimLocation.java | 45 - .../mso/apihandlerinfra/package-info.java | 30 - .../apihandlerinfra/tasksbeans/RequestDetails.java | 55 - .../apihandlerinfra/tasksbeans/RequestInfo.java | 73 -- .../mso/apihandlerinfra/tasksbeans/TaskList.java | 333 ------ .../tasksbeans/TaskRequestReference.java | 56 - .../tasksbeans/TaskVariableValue.java | 107 -- .../apihandlerinfra/tasksbeans/TaskVariables.java | 39 - .../tasksbeans/TasksGetResponse.java | 36 - .../apihandlerinfra/tasksbeans/TasksRequest.java | 34 - .../apihandlerinfra/tasksbeans/ValidResponses.java | 51 - .../mso/apihandlerinfra/tasksbeans/Value.java | 55 - .../mso/apihandlerinfra/tasksbeans/Variables.java | 74 -- .../tenantisolation/AaiClientPropertiesImpl.java | 62 - .../tenantisolation/CloudOrchestration.java | 334 ------ .../tenantisolation/CloudOrchestrationRequest.java | 81 -- .../CloudResourcesOrchestration.java | 335 ------ .../tenantisolation/GrmClientPropertiesImpl.java | 70 -- .../tenantisolation/ModelDistributionRequest.java | 160 --- .../OperationalEnvironmentProcessFactory.java | 54 - .../tenantisolation/TenantIsolationRequest.java | 476 -------- .../tenantisolation/TenantIsolationRunnable.java | 106 -- .../dmaap/CreateEcompOperationEnvironmentBean.java | 172 --- .../dmaap/DmaapOperationalEnvClient.java | 67 -- .../tenantisolation/dmaap/DmaapPropertiesImpl.java | 45 - .../dmaap/OperationalEnvironmentPublisher.java | 58 - .../exceptions/AAIClientCallFailed.java | 29 - .../exceptions/AsdcClientCallFailed.java | 34 - .../exceptions/TenantIsolationException.java | 36 - .../tenantisolation/helpers/AAIClientHelper.java | 145 --- .../helpers/AAIClientObjectBuilder.java | 78 -- .../tenantisolation/helpers/AsdcClientHelper.java | 216 ---- .../process/ActivateVnfOperationalEnvironment.java | 286 ----- .../ActivateVnfStatusOperationalEnvironment.java | 342 ------ .../process/CreateEcompOperationalEnvironment.java | 82 -- .../process/CreateVnfOperationalEnvironment.java | 216 ---- .../DeactivateVnfOperationalEnvironment.java | 92 -- .../process/OperationalEnvironmentProcess.java | 78 -- .../tenantisolationbeans/Action.java | 28 - .../CloudOrchestrationRequestList.java | 37 - .../CloudOrchestrationResponse.java | 38 - .../tenantisolationbeans/Distribution.java | 44 - .../tenantisolationbeans/DistributionStatus.java | 26 - .../tenantisolationbeans/InstanceReferences.java | 60 - .../tenantisolationbeans/Manifest.java | 53 - .../OperationalEnvironment.java | 27 - .../tenantisolationbeans/RecoveryAction.java | 28 - .../tenantisolationbeans/RelatedInstance.java | 68 -- .../tenantisolationbeans/RelatedInstanceList.java | 45 - .../tenantisolationbeans/Request.java | 90 -- .../tenantisolationbeans/RequestDetails.java | 104 -- .../tenantisolationbeans/RequestInfo.java | 118 -- .../tenantisolationbeans/RequestList.java | 96 -- .../tenantisolationbeans/RequestParameters.java | 84 -- .../tenantisolationbeans/RequestReferences.java | 96 -- .../tenantisolationbeans/RequestStatus.java | 69 -- .../tenantisolationbeans/ResourceType.java | 26 - .../tenantisolationbeans/ServiceModelList.java | 59 - .../tenantisolationbeans/Status.java | 26 - .../TenantIsolationRequest.java | 95 -- .../TenantIsolationResponse.java | 115 -- .../tenantisolationbeans/TenantSyncResponse.java | 35 - .../tenantisolationbeans/package-info.java | 29 - .../mso/apihandlerinfra/vnfbeans/ActionType.java | 80 -- .../mso/apihandlerinfra/vnfbeans/ModelType.java | 32 - .../apihandlerinfra/vnfbeans/ObjectFactory.java | 150 --- .../mso/apihandlerinfra/vnfbeans/RequestInfo.java | 286 ----- .../vnfbeans/RequestStatusType.java | 71 -- .../vnfbeans/VfModuleModelName.java | 261 ---- .../vnfbeans/VfModuleModelNames.java | 103 -- .../mso/apihandlerinfra/vnfbeans/VnfInputs.java | 689 ----------- .../mso/apihandlerinfra/vnfbeans/VnfOutputs.java | 291 ----- .../mso/apihandlerinfra/vnfbeans/VnfRequest.java | 179 --- .../mso/apihandlerinfra/vnfbeans/VnfRequests.java | 103 -- .../mso/apihandlerinfra/vnfbeans/VnfType.java | 148 --- .../mso/apihandlerinfra/vnfbeans/VnfTypes.java | 103 -- .../mso/apihandlerinfra/vnfbeans/package-info.java | 30 - 113 files changed, 15015 deletions(-) delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ModelType.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoException.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/CompareModelsRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/DelE2ESvcResp.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EParameters.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EService.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/LocationConstraint.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/VimLocation.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponse.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/ModelDistributionRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/OperationalEnvironmentProcessFactory.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AsdcClientCallFailed.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/TenantIsolationException.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AsdcClientHelper.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/OperationalEnvironmentProcess.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Action.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationRequestList.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationResponse.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Distribution.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/DistributionStatus.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/InstanceReferences.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Manifest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RecoveryAction.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstance.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstanceList.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Request.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestDetails.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestInfo.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestList.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestParameters.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestReferences.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestStatus.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ResourceType.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ServiceModelList.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Status.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantSyncResponse.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/package-info.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ActionType.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ModelType.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelName.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfInputs.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfOutputs.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfType.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp') diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java deleted file mode 100644 index 5c84e699d8..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - -/* - * Enum for Status values returned by API Handler to Tail-F -*/ -public enum Action { - createInstance, - updateInstance, - deleteInstance, - configureInstance, - replaceInstance, - activateInstance, - deactivateInstance, - enablePort, - disablePort, - addRelationships, - removeRelationships, - inPlaceSoftwareUpdate, - applyUpdatedConfig, - compareModel, - scaleInstance -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java deleted file mode 100644 index 477a7e46b4..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - - -public class Constants { - - private Constants() { - } - - public static final String REQUEST_ID_PATH = "/{request-id}"; - - public static final String STATUS_SUCCESS = "SUCCESS"; - - public static final String MODIFIED_BY_APIHANDLER = "APIH"; - - public static final long PROGRESS_REQUEST_COMPLETED = 100L; - public static final long PROGRESS_REQUEST_RECEIVED = 0L; - public static final long PROGRESS_REQUEST_IN_PROGRESS = 20L; - - public static final String VNF_TYPE_WILDCARD = "*"; - - public static final String VOLUME_GROUP_COMPONENT_TYPE = "VOLUME_GROUP"; - - public static final String VALID_INSTANCE_NAME_FORMAT = "^[a-zA-Z][a-zA-Z0-9._-]*$"; - - public static final String A_LA_CARTE = "aLaCarte"; - - public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java deleted file mode 100644 index ca821ecbc3..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java +++ /dev/null @@ -1,1189 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.json.JSONObject; -import org.openecomp.mso.apihandler.common.ErrorNumbers; -import org.openecomp.mso.apihandler.common.RequestClient; -import org.openecomp.mso.apihandler.common.RequestClientFactory; -import org.openecomp.mso.apihandler.common.RequestClientParamater; -import org.openecomp.mso.apihandler.common.ResponseHandler; -import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.CompareModelsRequest; -import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest; -import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceRequest; -import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceScaleRequest; -import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse; -import org.openecomp.mso.db.catalog.CatalogDatabase; -import org.openecomp.mso.db.catalog.beans.Service; -import org.openecomp.mso.db.catalog.beans.ServiceRecipe; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.OperationStatus; -import org.openecomp.mso.requestsdb.RequestsDatabase; -import org.openecomp.mso.serviceinstancebeans.ModelInfo; -import org.openecomp.mso.serviceinstancebeans.ModelType; -import org.openecomp.mso.serviceinstancebeans.RequestDetails; -import org.openecomp.mso.serviceinstancebeans.RequestInfo; -import org.openecomp.mso.serviceinstancebeans.RequestParameters; -import org.openecomp.mso.serviceinstancebeans.ServiceInstancesRequest; -import org.openecomp.mso.serviceinstancebeans.SubscriberInfo; -import org.openecomp.mso.utils.UUIDChecker; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; - -@Path("/e2eServiceInstances") -@Api(value = "/e2eServiceInstances", description = "API Requests for E2E Service Instances") -public class E2EServiceInstances { - - private HashMap instanceIdMap = new HashMap<>(); - private static MsoLogger msoLogger = MsoLogger - .getMsoLogger(MsoLogger.Catalog.APIH); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; - private ServiceInstancesRequest sir = null; - - public static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: "; - - /** - * POST Requests for E2E Service create Instance on a version provided - */ - - @POST - @Path("/{version:[vV][3-5]}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create an E2E Service Instance on a version provided", response = Response.class) - public Response createE2EServiceInstance(String request, - @PathParam("version") String version) { - - return processE2EserviceInstances(request, Action.createInstance, null, - version); - } - - /** - * PUT Requests for E2E Service update Instance on a version provided - */ - - @PUT - @Path("/{version:[vV][3-5]}/{serviceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update an E2E Service Instance on a version provided and serviceId", response = Response.class) - public Response updateE2EServiceInstance(String request, - @PathParam("version") String version, - @PathParam("serviceId") String serviceId) { - - instanceIdMap.put("serviceId", serviceId); - - return updateE2EserviceInstances(request, Action.updateInstance, instanceIdMap, - version); - } - - /** - * DELETE Requests for E2E Service delete Instance on a specified version - * and serviceId - */ - - @DELETE - @Path("/{version:[vV][3-5]}/{serviceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete E2E Service Instance on a specified version and serviceId", response = Response.class) - public Response deleteE2EServiceInstance(String request, - @PathParam("version") String version, - @PathParam("serviceId") String serviceId) { - - instanceIdMap.put("serviceId", serviceId); - - return deleteE2EserviceInstances(request, Action.deleteInstance, - instanceIdMap, version); - } - - @GET - @Path("/{version:[vV][3-5]}/{serviceId}/operations/{operationId}") - @ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId", response = Response.class) - @Produces(MediaType.APPLICATION_JSON) - public Response getE2EServiceInstances( - @PathParam("serviceId") String serviceId, - @PathParam("version") String version, - @PathParam("operationId") String operationId) { - return getE2EServiceInstances(serviceId, operationId); - } - - /** - * Scale Requests for E2E Service scale Instance on a specified version - */ - - @POST - @Path("/{version:[vV][3-5]}/{serviceId}/scale") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Scale E2E Service Instance on a specified version",response=Response.class) - public Response scaleE2EServiceInstance(String request, - @PathParam("version") String version, - @PathParam("serviceId") String serviceId) { - - msoLogger.debug("------------------scale begin------------------"); - instanceIdMap.put("serviceId", serviceId); - return scaleE2EserviceInstances(request, Action.scaleInstance, instanceIdMap, version); - } - /** - * GET Requests for Comparing model of service instance with target version - */ - - @POST - @Path("/{version:[vV][3-5]}/{serviceId}/modeldifferences") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId ", response = Response.class) - public Response compareModelwithTargetVersion(String request, - @PathParam("serviceId") String serviceId, - @PathParam("version") String version) { - - instanceIdMap.put("serviceId", serviceId); - - return compareModelwithTargetVersion(request, Action.compareModel, instanceIdMap, version); - } - - private Response compareModelwithTargetVersion(String requestJSON, Action action, - HashMap instanceIdMap, String version) { - - String requestId = UUIDChecker.generateUUID(msoLogger); - long startTime = System.currentTimeMillis(); - msoLogger.debug("requestId is: " + requestId); - - CompareModelsRequest e2eCompareModelReq = null; - - MsoRequest msoRequest = new MsoRequest(requestId); - - ObjectMapper mapper = new ObjectMapper(); - try { - e2eCompareModelReq = mapper.readValue(requestJSON, CompareModelsRequest.class); - - } catch (Exception e) { - - msoLogger.debug("Mapping of request to JSON object failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, - "Mapping of request to JSON object failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity().toString()); - - return response; - } - - return runCompareModelBPMWorkflow(e2eCompareModelReq, msoRequest, requestJSON, requestId, startTime, action); - - } - - private Response runCompareModelBPMWorkflow(CompareModelsRequest e2eCompareModelReq, MsoRequest msoRequest, - String requestJSON, String requestId, long startTime, Action action) { - - // Define RecipeLookupResult info here instead of query DB for efficiency - String workflowUrl = "/mso/async/services/CompareModelofE2EServiceInstance"; - - RequestClient requestClient = null; - HttpResponse response = null; - - long subStartTime = System.currentTimeMillis(); - - try { - requestClient = RequestClientFactory.getRequestClient(workflowUrl, MsoPropertiesUtils.loadMsoProperties()); - - JSONObject jjo = new JSONObject(requestJSON); - - // Capture audit event - msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); - RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). - setBaseVfModule(false).setRecipeTimeout(180).setRequestAction(action.name()). - setServiceInstanceId(instanceIdMap.get("serviceId")).setServiceType(e2eCompareModelReq.getServiceType()). - setRequestDetails(jjo.toString()).build(); - - response = requestClient.post(requestClientParamater); - - msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully received response from BPMN engine", "BPMN", workflowUrl, null); - } catch (Exception e) { - msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", - workflowUrl, null); - Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL, - Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine",e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine"); - msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString()); - return resp; - } - - if (response == null) { - Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, - "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString()); - return resp; - } - - ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType()); - int bpelStatus = respHandler.getStatus(); - - return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, - instanceIdMap); - } - - private Response getE2EServiceInstances(String serviceId, String operationId) { - RequestsDatabase requestsDB = RequestsDatabase.getInstance(); - - GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse(); - - MsoRequest msoRequest = new MsoRequest(serviceId); - - long startTime = System.currentTimeMillis(); - - OperationStatus operationStatus = null; - - try { - operationStatus = requestsDB.getOperationStatus(serviceId, - operationId); - - } catch (Exception e) { - msoLogger - .error(MessageEnum.APIH_DB_ACCESS_EXC, - MSO_PROP_APIHANDLER_INFRA, - "", - "", - MsoLogger.ErrorCode.AvailabilityError, - "Exception while communciate with Request DB - Infra Request Lookup", - e); - msoRequest - .setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse( - HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, - e.getMessage(), - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null); - alarmLogger.sendAlarm("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, Messages.errors - .get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.DBAccessError, - "Exception while communciate with Request DB"); - msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); - return response; - - } - - if (operationStatus == null) { - Response resp = msoRequest.buildServiceErrorResponse( - HttpStatus.SC_NO_CONTENT, MsoException.ServiceException, - "E2E serviceId " + serviceId + " is not found in DB", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, - "Null response from RequestDB when searching by serviceId"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.DataNotFound, - "Null response from RequestDB when searching by serviceId"); - msoLogger.debug(END_OF_THE_TRANSACTION - + (String) resp.getEntity()); - return resp; - - } - - e2eServiceResponse.setOperationStatus(operationStatus); - - return Response.status(200).entity(e2eServiceResponse).build(); - } - - private Response deleteE2EserviceInstances(String requestJSON, - Action action, HashMap instanceIdMap, String version) { - // TODO should be a new one or the same service instance Id - String requestId = UUIDChecker.generateUUID(msoLogger); - long startTime = System.currentTimeMillis(); - msoLogger.debug("requestId is: " + requestId); - E2EServiceInstanceDeleteRequest e2eDelReq = null; - - MsoRequest msoRequest = new MsoRequest(requestId); - - ObjectMapper mapper = new ObjectMapper(); - try { - e2eDelReq = mapper.readValue(requestJSON, - E2EServiceInstanceDeleteRequest.class); - - } catch (Exception e) { - - msoLogger.debug("Mapping of request to JSON object failed : ", e); - Response response = msoRequest.buildServiceErrorResponse( - HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, - "Mapping of request to JSON object failed. " - + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, - null); - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.SchemaError, - "Mapping of request to JSON object failed"); - msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); - return response; - } - - CatalogDatabase db = null; - RecipeLookupResult recipeLookupResult = null; - try { - db = CatalogDatabase.getInstance(); - //TODO Get the service template model version uuid from AAI. - recipeLookupResult = getServiceInstanceOrchestrationURI(db, null, action); - } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, - "Exception while communciate with Catalog DB", e); - msoRequest - .setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse( - HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, - "No communication to catalog DB " + e.getMessage(), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - alarmLogger.sendAlarm("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, Messages.errors - .get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB)); - msoRequest.createRequestRecord(Status.FAILED, action); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.DBAccessError, - "Exception while communciate with DB"); - msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); - return response; - } finally { - closeCatalogDB(db); - } - if (recipeLookupResult == null) { - msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.DataError, "No recipe found in DB"); - msoRequest - .setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse( - HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, - "Recipe does not exist in catalog DB", - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null); - msoRequest.createRequestRecord(Status.FAILED, action); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.DataNotFound, - "No recipe found in DB"); - msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); - return response; - } - - RequestClient requestClient = null; - HttpResponse response = null; - - long subStartTime = System.currentTimeMillis(); - try { - requestClient = RequestClientFactory.getRequestClient( - recipeLookupResult.getOrchestrationURI(), - MsoPropertiesUtils.loadMsoProperties()); - - JSONObject jjo = new JSONObject(requestJSON); - jjo.put("operationId", UUIDChecker.generateUUID(msoLogger)); - // Capture audit event - msoLogger - .debug("MSO API Handler Posting call to BPEL engine for url: " - + requestClient.getUrl()); - - RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). - setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()). - setRequestAction(action.name()).setServiceInstanceId(instanceIdMap.get("serviceId")). - setServiceType(e2eDelReq.getServiceType()).setRequestDetails(jjo.toString()). - setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); - response = requestClient.post(requestClientParamater); - - msoLogger.recordMetricEvent(subStartTime, - MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully received response from BPMN engine", "BPMN", - recipeLookupResult.getOrchestrationURI(), null); - } catch (Exception e) { - msoLogger.recordMetricEvent(subStartTime, - MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine", "BPMN", - recipeLookupResult.getOrchestrationURI(), null); - Response resp = msoRequest.buildServiceErrorResponse( - HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, - "Failed calling bpmn " + e.getMessage(), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - alarmLogger.sendAlarm("MsoConfigurationError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, - "Exception while communicate with BPMN engine"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine"); - msoLogger.debug("End of the transaction, the final response is: " - + (String) resp.getEntity()); - return resp; - } - - if (response == null) { - Response resp = msoRequest.buildServiceErrorResponse( - HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, - "bpelResponse is null", - ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, - "Null response from BPEL"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.InternalError, - "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity()); - return resp; - } - - ResponseHandler respHandler = new ResponseHandler(response, - requestClient.getType()); - int bpelStatus = respHandler.getStatus(); - - return beplStatusUpdate(requestId, startTime, msoRequest, - requestClient, respHandler, bpelStatus, action, instanceIdMap); - } - - private Response updateE2EserviceInstances(String requestJSON, Action action, - HashMap instanceIdMap, String version) { - - String requestId = UUIDChecker.generateUUID(msoLogger); - long startTime = System.currentTimeMillis(); - msoLogger.debug("requestId is: " + requestId); - E2EServiceInstanceRequest e2eSir = null; - String serviceId = instanceIdMap.get("serviceId"); - - MsoRequest msoRequest = new MsoRequest(requestId); - ObjectMapper mapper = new ObjectMapper(); - try { - e2eSir = mapper.readValue(requestJSON, E2EServiceInstanceRequest.class); - - } catch (Exception e) { - - msoLogger.debug("Mapping of request to JSON object failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, - "Mapping of request to JSON object failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); - return response; - } - - mapReqJsonToSvcInstReq(e2eSir, requestJSON); - sir.getRequestDetails().getRequestParameters().setaLaCarte(true); - try { - msoRequest.parse(sir, instanceIdMap, action, version, requestJSON); - } catch (Exception e) { - msoLogger.debug("Validation failed: ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, "Error parsing request. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId() != null) { - msoLogger.debug("Logging failed message to the database"); - } - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, - "Validation of the input request failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); - return response; - } - - CatalogDatabase db = null; - RecipeLookupResult recipeLookupResult = null; - try { - db = CatalogDatabase.getInstance(); - recipeLookupResult = getServiceInstanceOrchestrationURI(db, e2eSir.getService().getServiceUuid(), action); - } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e); - msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL, - Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB)); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, - "Exception while communciate with DB"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); - - return response; - } finally { - closeCatalogDB(db); - } - - if (recipeLookupResult == null) { - msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.DataError, "No recipe found in DB"); - msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, "Recipe does not exist in catalog DB", - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, - "No recipe found in DB"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); - - return response; - } - - String serviceInstanceType = e2eSir.getService().getServiceType(); - - RequestClient requestClient = null; - HttpResponse response = null; - - long subStartTime = System.currentTimeMillis(); - try { - requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(), - MsoPropertiesUtils.loadMsoProperties()); - - // Capture audit event - msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); - RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). - setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()). - setServiceInstanceId(serviceId).setServiceType(serviceInstanceType). - setRequestDetails(mapReqJsonToSvcInstReq(e2eSir, requestJSON)). - setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); - - response = requestClient.post(requestClientParamater); - - msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(), - null); - } catch (Exception e) { - msoLogger.debug("Exception while communicate with BPMN engine", e); - msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", - recipeLookupResult.getOrchestrationURI(), null); - Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL, - Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) getBPMNResp.getEntity()); - - return getBPMNResp; - } - - if (response == null) { - Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, - "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) getBPMNResp.getEntity()); - - return getBPMNResp; - } - - ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType()); - int bpelStatus = respHandler.getStatus(); - - return beplStatusUpdate(serviceId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, instanceIdMap); - } - - private Response processE2EserviceInstances(String requestJSON, Action action, - HashMap instanceIdMap, String version) { - - String requestId = UUIDChecker.generateUUID(msoLogger); - long startTime = System.currentTimeMillis(); - msoLogger.debug("requestId is: " + requestId); - E2EServiceInstanceRequest e2eSir = null; - - MsoRequest msoRequest = new MsoRequest(requestId); - ObjectMapper mapper = new ObjectMapper(); - try { - e2eSir = mapper.readValue(requestJSON, E2EServiceInstanceRequest.class); - - } catch (Exception e) { - - msoLogger.debug("Mapping of request to JSON object failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, - "Mapping of request to JSON object failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); - return response; - } - - mapReqJsonToSvcInstReq(e2eSir, requestJSON); - sir.getRequestDetails().getRequestParameters().setaLaCarte(true); - try { - msoRequest.parse(sir, instanceIdMap, action, version, requestJSON); - } catch (Exception e) { - msoLogger.debug("Validation failed: ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, "Error parsing request. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId() != null) { - msoLogger.debug("Logging failed message to the database"); - } - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, - "Validation of the input request failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); - return response; - } - - CatalogDatabase db = null; - RecipeLookupResult recipeLookupResult = null; - try { - db = CatalogDatabase.getInstance(); - recipeLookupResult = getServiceInstanceOrchestrationURI(db, e2eSir.getService().getServiceUuid(), action); - } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e); - msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL, - Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB)); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, - "Exception while communciate with DB"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); - return response; - } finally { - closeCatalogDB(db); - } - - if (recipeLookupResult == null) { - msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.DataError, "No recipe found in DB"); - msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, "Recipe does not exist in catalog DB", - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, - "No recipe found in DB"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); - return response; - } - - RequestClient requestClient = null; - HttpResponse response = null; - - long subStartTime = System.currentTimeMillis(); - try { - requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(), - MsoPropertiesUtils.loadMsoProperties()); - - // Capture audit event - msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); - RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). - setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()). - setServiceInstanceId("").setServiceType(e2eSir.getService().getServiceType()). - setRequestDetails(mapReqJsonToSvcInstReq(e2eSir, requestJSON)). - setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); - - response = requestClient.post(requestClientParamater); - - msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(), - null); - } catch (Exception e) { - msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", - recipeLookupResult.getOrchestrationURI(), null); - Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL, - Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity()); - return resp; - } - - if (response == null) { - Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, - "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity()); - return resp; - } - - ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType()); - int bpelStatus = respHandler.getStatus(); - - return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, instanceIdMap); - } - - private Response scaleE2EserviceInstances(String requestJSON, - Action action, HashMap instanceIdMap, String version) { - - String requestId = UUIDChecker.generateUUID(msoLogger); - long startTime = System.currentTimeMillis(); - msoLogger.debug("requestId is: " + requestId); - E2EServiceInstanceScaleRequest e2eScaleReq = null; - - MsoRequest msoRequest = new MsoRequest(requestId); - - ObjectMapper mapper = new ObjectMapper(); - try { - e2eScaleReq = mapper.readValue(requestJSON, - E2EServiceInstanceScaleRequest.class); - - } catch (Exception e) { - - msoLogger.debug("Mapping of request to JSON object failed : ", e); - Response response = msoRequest.buildServiceErrorResponse( - HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, - "Mapping of request to JSON object failed. " - + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, - null); - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.SchemaError, - "Mapping of request to JSON object failed"); - msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); - return response; - } - - CatalogDatabase db = null; - RecipeLookupResult recipeLookupResult = null; - try { - db = CatalogDatabase.getInstance(); - //TODO Get the service template model version uuid from AAI. - recipeLookupResult = getServiceInstanceOrchestrationURI(db, null, action); - } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, - "Exception while communciate with Catalog DB", e); - msoRequest - .setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse( - HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, - "No communication to catalog DB " + e.getMessage(), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - alarmLogger.sendAlarm("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, Messages.errors - .get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB)); - msoRequest.createRequestRecord(Status.FAILED, action); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.DBAccessError, - "Exception while communciate with DB"); - msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); - return response; - } finally { - closeCatalogDB(db); - } - if (recipeLookupResult == null) { - msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.DataError, "No recipe found in DB"); - msoRequest - .setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse( - HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, - "Recipe does not exist in catalog DB", - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null); - msoRequest.createRequestRecord(Status.FAILED, action); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.DataNotFound, - "No recipe found in DB"); - msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); - return response; - } - - RequestClient requestClient = null; - HttpResponse response = null; - - long subStartTime = System.currentTimeMillis(); - try { - requestClient = RequestClientFactory.getRequestClient( - recipeLookupResult.getOrchestrationURI(), - MsoPropertiesUtils.loadMsoProperties()); - - JSONObject jjo = new JSONObject(requestJSON); - jjo.put("operationId", UUIDChecker.generateUUID(msoLogger)); - - // Capture audit event - msoLogger - .debug("MSO API Handler Posting call to BPEL engine for url: " - + requestClient.getUrl()); - RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). - setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()). - setServiceInstanceId(instanceIdMap.get("serviceId")). - setServiceType(e2eScaleReq.getService().getServiceType()). - setRequestDetails(jjo.toString()). - setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); - - response = requestClient.post(requestClientParamater); - - msoLogger.recordMetricEvent(subStartTime, - MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully received response from BPMN engine", "BPMN", - recipeLookupResult.getOrchestrationURI(), null); - } catch (Exception e) { - msoLogger.recordMetricEvent(subStartTime, - MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine", "BPMN", - recipeLookupResult.getOrchestrationURI(), null); - Response resp = msoRequest.buildServiceErrorResponse( - HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, - "Failed calling bpmn " + e.getMessage(), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - alarmLogger.sendAlarm("MsoConfigurationError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, - "Exception while communicate with BPMN engine",e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine"); - msoLogger.debug(END_OF_THE_TRANSACTION - + (String) resp.getEntity()); - return resp; - } - - if (response == null) { - Response resp = msoRequest.buildServiceErrorResponse( - HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, - "bpelResponse is null", - ErrorNumbers.SVC_NO_SERVER_RESOURCES, null); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, - "Null response from BPEL"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.InternalError, - "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity()); - return resp; - } - - ResponseHandler respHandler = new ResponseHandler(response, - requestClient.getType()); - int bpelStatus = respHandler.getStatus(); - - return beplStatusUpdate(requestId, startTime, msoRequest, - requestClient, respHandler, bpelStatus, action, instanceIdMap); - } - - private void closeCatalogDB(CatalogDatabase db) { - if (db != null) { - db.close(); - } - } - - private Response beplStatusUpdate(String serviceId, long startTime, - MsoRequest msoRequest, RequestClient requestClient, - ResponseHandler respHandler, int bpelStatus, Action action, - HashMap instanceIdMap) { - // BPMN accepted the request, the request is in progress - if (bpelStatus == HttpStatus.SC_ACCEPTED) { - String camundaJSONResponseBody = respHandler.getContent(); - msoLogger.debug("Received from Camunda: " + camundaJSONResponseBody); - msoLogger.recordAuditEvent(startTime, - MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "BPMN accepted the request, the request is in progress"); - msoLogger.debug(END_OF_THE_TRANSACTION + camundaJSONResponseBody); - return Response.status(HttpStatus.SC_ACCEPTED) - .entity(camundaJSONResponseBody).build(); - } else { - List variables = new ArrayList<>(); - variables.add(bpelStatus + ""); - String camundaJSONResponseBody = respHandler.getContent(); - if (camundaJSONResponseBody != null - && !camundaJSONResponseBody.isEmpty()) { - Response resp = msoRequest.buildServiceErrorResponse( - bpelStatus, MsoException.ServiceException, - "Request Failed due to BPEL error with HTTP Status= %1 " - + '\n' + camundaJSONResponseBody, - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables); - msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR, - requestClient.getUrl(), "", "", - MsoLogger.ErrorCode.BusinessProcesssError, - "Response from BPEL engine is failed with HTTP Status=" - + bpelStatus); - msoLogger.recordAuditEvent(startTime, - MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.InternalError, - "Response from BPMN engine is failed"); - msoLogger.debug(END_OF_THE_TRANSACTION - + (String) resp.getEntity()); - return resp; - } else { - Response resp = msoRequest - .buildServiceErrorResponse( - bpelStatus, - MsoException.ServiceException, - "Request Failed due to BPEL error with HTTP Status= %1", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - variables); - msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR, - requestClient.getUrl(), "", "", - MsoLogger.ErrorCode.BusinessProcesssError, - "Response from BPEL engine is empty"); - msoLogger.recordAuditEvent(startTime, - MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.InternalError, - "Response from BPEL engine is empty"); - msoLogger.debug(END_OF_THE_TRANSACTION - + (String) resp.getEntity()); - return resp; - } - } - } - - /** - * Getting recipes from catalogDb - * - * @param db the catalog db - * @param serviceModelUUID the service model version uuid - * @param action the action for the service - * @return the service recipe result - */ - private RecipeLookupResult getServiceInstanceOrchestrationURI( - CatalogDatabase db, String serviceModelUUID, Action action) { - - RecipeLookupResult recipeLookupResult = getServiceURI(db, serviceModelUUID, action); - - if (recipeLookupResult != null) { - msoLogger.debug("Orchestration URI is: " - + recipeLookupResult.getOrchestrationURI() - + ", recipe Timeout is: " - + Integer.toString(recipeLookupResult.getRecipeTimeout())); - } else { - msoLogger.debug("No matching recipe record found"); - } - return recipeLookupResult; - } - - /** - * Getting recipes from catalogDb - * If Service recipe is not set, use default recipe, if set , use special recipe. - * @param db the catalog db - * @param serviceModelUUID the service version uuid - * @param action the action of the service. - * @return the service recipe result. - */ - private RecipeLookupResult getServiceURI(CatalogDatabase db, String serviceModelUUID, Action action) { - - String defaultServiceModelName = "UUI_DEFAULT"; - - Service defaultServiceRecord = db - .getServiceByModelName(defaultServiceModelName); - ServiceRecipe defaultRecipe = db.getServiceRecipeByModelUUID( - defaultServiceRecord.getModelUUID(), action.name()); - //set recipe as default generic recipe - ServiceRecipe recipe = defaultRecipe; - //check the service special recipe - if(null != serviceModelUUID && ! serviceModelUUID.isEmpty()){ - ServiceRecipe serviceSpecialRecipe = db.getServiceRecipeByModelUUID( - serviceModelUUID, action.name()); - if(null != serviceSpecialRecipe){ - //set service special recipe. - recipe = serviceSpecialRecipe; - } - } - - if (recipe == null) { - return null; - } - return new RecipeLookupResult(recipe.getOrchestrationUri(), - recipe.getRecipeTimeout(), recipe.getServiceParamXSD()); - - } - - /** - * Converting E2EServiceInstanceRequest to ServiceInstanceRequest and - * passing it to camunda engine. - * - * @param e2eSir - * @return - */ - private String mapReqJsonToSvcInstReq(E2EServiceInstanceRequest e2eSir, - String requestJSON) { - - sir = new ServiceInstancesRequest(); - - String returnString = null; - RequestDetails requestDetails = new RequestDetails(); - ModelInfo modelInfo = new ModelInfo(); - - // ModelInvariantId - modelInfo.setModelInvariantId(e2eSir.getService().getServiceInvariantUuid()); - - // modelNameVersionId - modelInfo.setModelNameVersionId(e2eSir.getService().getServiceUuid()); - - // String modelInfoValue = - // e2eSir.getService().getParameters().getNodeTemplateName(); - // String[] arrayOfInfo = modelInfoValue.split(":"); - // String modelName = arrayOfInfo[0]; - // String modelVersion = arrayOfInfo[1]; - - // TODO: To ensure, if we dont get the values from the UUI - String modelName = "voLTE"; - String modelVersion = "1.0"; - // modelName - modelInfo.setModelName(modelName); - - // modelVersion - modelInfo.setModelVersion(modelVersion); - - // modelType - modelInfo.setModelType(ModelType.service); - - // setting modelInfo to requestDetails - requestDetails.setModelInfo(modelInfo); - - SubscriberInfo subscriberInfo = new SubscriberInfo(); - - // globalsubscriberId - subscriberInfo.setGlobalSubscriberId(e2eSir.getService().getGlobalSubscriberId()); - - // setting subscriberInfo to requestDetails - requestDetails.setSubscriberInfo(subscriberInfo); - - RequestInfo requestInfo = new RequestInfo(); - - // instanceName - requestInfo.setInstanceName(e2eSir.getService().getName()); - - // source - requestInfo.setSource("UUI"); - - // suppressRollback - requestInfo.setSuppressRollback(true); - - // setting requestInfo to requestDetails - requestDetails.setRequestInfo(requestInfo); - - RequestParameters requestParameters = new RequestParameters(); - - // subscriptionServiceType - requestParameters.setSubscriptionServiceType("MOG"); - - // Userparams - //List userParams; - // userParams = - // e2eSir.getService().getParameters().getRequestParameters().getUserParams(); - List> userParamList = new ArrayList<>(); - Map userParamMap = new HashMap<>(); - // complete json request updated in the camunda - userParamMap.put("UUIRequest", requestJSON); - userParamMap.put("ServiceInstanceName", e2eSir.getService().getName()); - - // Map userParamMap3 = null; - // for (E2EUserParam userp : userParams) { - // userParamMap.put(userp.getName(), userp.getValue()); - // - // } - userParamList.add(userParamMap); - requestParameters.setUserParams(userParamList); - - // setting requestParameters to requestDetails - requestDetails.setRequestParameters(requestParameters); - - sir.setRequestDetails(requestDetails); - - // converting to string - ObjectMapper mapper = new ObjectMapper(); - try { - returnString = mapper.writeValueAsString(sir); - } catch (IOException e) { - msoLogger - .debug("Exception while converting ServiceInstancesRequest object to string", - e); - } - - return returnString; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java deleted file mode 100644 index 811b6109b4..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.HEAD; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Response; - -import org.openecomp.mso.HealthCheckUtils; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.utils.UUIDChecker; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; - -@Path("/globalhealthcheck") -@Api(value="/globalhealthcheck",description="APIH Infra Global Health Check") -public class GlobalHealthcheckHandler { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - - @HEAD - @GET - @Produces("text/html") - @ApiOperation(value="Performing global health check",response=Response.class) - public Response globalHealthcheck (@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn) { - long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("GlobalHealthcheck"); - // Generate a Request Id - String requestId = UUIDChecker.generateUUID(msoLogger); - HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck (msoLogger)) { - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - - if (healthCheck.verifyGlobalHealthCheck(enableBpmn, requestId)) { - msoLogger.debug("globalHealthcheck - Successful"); - return HealthCheckUtils.HEALTH_CHECK_RESPONSE; - } else { - msoLogger.debug("globalHealthcheck - At leaset one of the sub-modules is not available"); - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java deleted file mode 100644 index 86604b392a..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - -import javax.ws.rs.GET; -import javax.ws.rs.HEAD; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Response; - -import org.openecomp.mso.HealthCheckUtils; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.utils.UUIDChecker; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; - -@Path("/healthcheck") -@Api(value="/healthcheck",description="API Handler Infra Health Check") -public class HealthcheckHandler { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - - @HEAD - @GET - @Produces("text/html") - @ApiOperation(value="Perform Health Check",response=Response.class) - public Response healthcheck (@QueryParam("requestId") String requestId) { - long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("Healthcheck"); - UUIDChecker.verifyOldUUID(requestId, msoLogger); - HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck(msoLogger)) { - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - - if (!healthCheck.configFileCheck(msoLogger, startTime, Constants.MSO_PROP_APIHANDLER_INFRA)) { - return HealthCheckUtils.NOT_STARTED_RESPONSE; - } - - if (!healthCheck.requestDBCheck (msoLogger, startTime)) { - return HealthCheckUtils.NOT_STARTED_RESPONSE; - } - msoLogger.debug("healthcheck - Successful"); - return HealthCheckUtils.HEALTH_CHECK_RESPONSE; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java deleted file mode 100644 index 1d70224100..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - - - -import java.util.Arrays; - -import org.openecomp.mso.properties.MsoJavaProperties; - -public class InfraUtils { - public static boolean isActionAllowed(MsoJavaProperties props, String requestType, String version, String action) { - // Check for allowable actions - String actionsPropertyName = requestType + "." + version + ".ApiAllowableActions"; - String allowableActions = props.getProperty(actionsPropertyName, null); - return allowableActions == null || Arrays.asList(allowableActions.split(",")).contains(action); - } - - // Checks if the name is acceptable for heat stack - public static boolean isValidHeatName(String name) { - return name.matches("^[a-zA-Z][a-zA-Z0-9_\\.-]*$"); - } - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java deleted file mode 100644 index e268c65263..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java +++ /dev/null @@ -1,227 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.apihandlerinfra; - -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.utils.UUIDChecker; - -import com.wordnik.swagger.annotations.ApiOperation; - -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.openecomp.mso.apihandler.common.ValidationException; -import org.openecomp.mso.apihandler.common.ErrorNumbers; -import org.openecomp.mso.apihandler.common.RequestClient; -import org.openecomp.mso.apihandler.common.RequestClientFactory; -import org.openecomp.mso.apihandler.common.ResponseHandler; -import org.openecomp.mso.apihandlerinfra.tasksbeans.*; - -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - - -@Path("/tasks") -public class ManualTasks { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); - - @POST - @Path("/{version:[vV]1}/{taskId}/complete") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Complete specified task",response=Response.class) - public Response completeTask(String request, @PathParam("version") String version, @PathParam("taskId") String taskId) { - - String requestId = UUIDChecker.generateUUID(msoLogger); - long startTime = System.currentTimeMillis (); - msoLogger.debug ("requestId is: " + requestId); - TasksRequest tr = null; - - MsoRequest msoRequest = new MsoRequest (requestId); - - try{ - ObjectMapper mapper = new ObjectMapper(); - tr= mapper.readValue(request, TasksRequest.class); - - if (tr.getRequestDetails() == null) { - throw new ValidationException("requestDetails"); - } - if (tr.getRequestDetails().getRequestInfo() == null) { - throw new ValidationException("requestInfo"); - } - if (empty(tr.getRequestDetails().getRequestInfo().getSource())) { - throw new ValidationException("source"); - } - if (empty(tr.getRequestDetails().getRequestInfo().getRequestorId())) { - throw new ValidationException("requestorId"); - } - - } catch(Exception e){ - msoLogger.debug ("Mapping of request to JSON object failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Mapping of request to JSON object failed. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, request, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - // Transform the request to Camunda-style Complete request - Variables variablesForComplete = new Variables(); - Value sourceValue = new Value(); - sourceValue.setValue(tr.getRequestDetails().getRequestInfo().getSource()); - Value responseValue = new Value(); - responseValue.setValue(tr.getRequestDetails().getRequestInfo().getResponseValue().name()); - Value requestorIdValue = new Value(); - requestorIdValue.setValue(tr.getRequestDetails().getRequestInfo().getRequestorId()); - variablesForComplete.setSource(sourceValue); - variablesForComplete.setResponseValue(responseValue); - variablesForComplete.setRequestorId(requestorIdValue); - - String camundaJsonReq = null; - try { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - camundaJsonReq = mapper.writeValueAsString(variablesForComplete); - msoLogger.debug("Camunda Json Request: " + camundaJsonReq); - } catch(Exception e){ - msoLogger.debug ("Mapping of JSON object to Camunda request failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, - "Mapping of JSON object to Camunda Request failed. " + e.getMessage(), - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null); - - msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.UnknownError, request, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Mapping of JSON object to Camunda request failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - RequestClient requestClient = null; - HttpResponse response = null; - long subStartTime = System.currentTimeMillis(); - String requestUrl = "/mso/task/" + taskId + "/complete"; - try { - requestClient = RequestClientFactory.getRequestClient (requestUrl, MsoPropertiesUtils.loadMsoProperties ()); - // Capture audit event - msoLogger.debug ("MSO API Handler Posting call to Camunda engine for url: " + requestClient.getUrl ()); - - System.out.println("URL : " + requestClient.getUrl ()); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Mapping of JSON object to Camunda request failed"); - - response = requestClient.post(camundaJsonReq); - - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", requestUrl, null); - } catch (Exception e) { - msoLogger.debug ("Exception:", e); - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", requestUrl, null); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, - "Failed calling bpmn " + e.getMessage (), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - alarmLogger.sendAlarm ("MsoConfigurationError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - if (response == null) { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, - "bpelResponse is null", - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ()); - int bpelStatus = respHandler.getStatus (); - - // BPEL accepted the request, the request is in progress - if (bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) { - msoLogger.debug ("Received good response from Camunda"); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request"); - TaskRequestReference trr = new TaskRequestReference(); - trr.setTaskId(taskId); - String completeResp = null; - try { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - completeResp = mapper.writeValueAsString(trr); - } - catch (Exception e) { - msoLogger.debug("Unable to format response",e); - Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, - MsoException.ServiceException, - "Request Failed due to bad response format" , - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Bad response format"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Bad response format"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - msoLogger.debug("Response to the caller: " + completeResp); - msoLogger.debug ("End of the transaction, the final response is: " + (String) completeResp); - return Response.status (HttpStatus.SC_ACCEPTED).entity (completeResp).build (); - } else { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, - MsoException.ServiceException, - "Request Failed due to BPEL error with HTTP Status= %1" , - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - } - - private static boolean empty(String s) { - return (s == null || s.trim().isEmpty()); - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java deleted file mode 100644 index f46d327531..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - - -import java.util.HashMap; -import java.util.Map; - -import org.openecomp.mso.apihandler.common.ErrorNumbers; - -public class Messages { - - protected static final Map errors = new HashMap<>(); - static { - errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_service", "Service request FAILED schema validation. %s"); - errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_feature", "Feature request FAILED schema validation. %s"); - errors.put(ErrorNumbers.RECIPE_DOES_NOT_EXIST, "Recipe for %s-type and action specified does not exist in catalog %s"); - errors.put(ErrorNumbers.SERVICE_PARAMETERS_FAILED_SCHEMA_VALIDATION, "Service specific parameters passed in request FAILED schema validation. %s"); - - errors.put(ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS, "%s-name (%s) is locked (status = %s) because already working on a CREATE request with same %s-name."); - errors.put(ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID, "%s-id (%s) is locked (status = %s) because already working on a request with same action (%s) for this %s-id."); - errors.put(ErrorNumbers.REQUEST_TIMED_OUT, "Service request timed out before completing"); - errors.put(ErrorNumbers.ERROR_FROM_BPEL, "BPEL returned an error: %s"); - errors.put(ErrorNumbers.NO_COMMUNICATION_TO_BPEL, "Could not communicate with BPEL %s"); - errors.put(ErrorNumbers.NO_RESPONSE_FROM_BPEL, "No response from BPEL %s"); - errors.put(ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, "Could not insert or update record in MSO_REQUESTS DB %s"); - errors.put(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, "Could not communicate with MSO_REQUESTS DB %s"); - errors.put(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB, "Could not communicate with MSO_CATALOG DB %s"); - errors.put(ErrorNumbers.ERROR_FROM_CATALOG_DB, "Received error from MSO_CATALOG DB %s"); - } - - private Messages(){ - } - - public static Map getErrors() { - return errors; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ModelType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ModelType.java deleted file mode 100644 index 1db847e9d9..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ModelType.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - -/* - * Enum for Status values returned by API Handler to Tail-F -*/ -public enum ModelType { - service, - vnf, - vfModule, - volumeGroup, - network -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoException.java deleted file mode 100644 index 5204816bb8..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoException.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - -public enum MsoException { - ServiceException, - PolicyException, -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java deleted file mode 100644 index 28076b17fe..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.apihandlerinfra; - -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -public class MsoPropertiesUtils { - - private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory (); - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - - private static boolean noProperties = true; - - public synchronized static MsoJavaProperties loadMsoProperties () { - MsoJavaProperties msoProperties; - try { - msoProperties = msoPropertiesFactory.getMsoJavaProperties (Constants.MSO_PROP_APIHANDLER_INFRA); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_LOAD_PROPERTIES_FAIL, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception when loading MSO Properties", e); - return null; - } - - if (msoProperties != null && msoProperties.size () > 0) { - noProperties = false; - msoLogger.info (MessageEnum.APIH_PROPERTY_LOAD_SUC, "", ""); - return msoProperties; - } else { - msoLogger.error (MessageEnum.APIH_NO_PROPERTIES, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No MSO APIH_INFRA Properties found"); - return null; - } - } - - public synchronized static final boolean getNoPropertiesState() { - return noProperties; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java deleted file mode 100644 index 3f6cc35432..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java +++ /dev/null @@ -1,1186 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - -import java.io.IOException; -import java.io.StringWriter; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.StringTokenizer; - -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.hibernate.Session; -import org.openecomp.mso.apihandler.common.ValidationException; -import org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType; -import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfInputs; -import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest; -import org.openecomp.mso.db.AbstractSessionFactoryManager; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.InfraActiveRequests; -import org.openecomp.mso.requestsdb.RequestsDatabase; -import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager; -import org.openecomp.mso.serviceinstancebeans.CloudConfiguration; -import org.openecomp.mso.serviceinstancebeans.InstanceDirection; -import org.openecomp.mso.serviceinstancebeans.LineOfBusiness; -import org.openecomp.mso.serviceinstancebeans.ModelInfo; -import org.openecomp.mso.serviceinstancebeans.ModelType; -import org.openecomp.mso.serviceinstancebeans.OwningEntity; -import org.openecomp.mso.serviceinstancebeans.Platform; -import org.openecomp.mso.serviceinstancebeans.PolicyException; -import org.openecomp.mso.serviceinstancebeans.Project; -import org.openecomp.mso.serviceinstancebeans.RelatedInstance; -import org.openecomp.mso.serviceinstancebeans.RelatedInstanceList; -import org.openecomp.mso.serviceinstancebeans.RequestError; -import org.openecomp.mso.serviceinstancebeans.RequestInfo; -import org.openecomp.mso.serviceinstancebeans.RequestParameters; -import org.openecomp.mso.serviceinstancebeans.ServiceException; -import org.openecomp.mso.serviceinstancebeans.ServiceInstancesRequest; -import org.openecomp.mso.serviceinstancebeans.SubscriberInfo; -import org.openecomp.mso.utils.UUIDChecker; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class MsoRequest { - - private String requestId; - private String requestXML; - private String requestUri; - private VnfRequest vnfReq; - private RequestInfo requestInfo; - private ModelInfo modelInfo; - private CloudConfiguration cloudConfiguration ; - private VnfInputs vnfInputs; - private String vnfParams; - private Action action; - private String errorMessage; - private String errorCode; - private String httpResponse; - private String responseBody; - private String originalRequestJSON; - private RequestStatusType status; - private ServiceInstancesRequest sir; - private long startTime; - private long progress = Constants.PROGRESS_REQUEST_RECEIVED; - private String serviceInstanceType; - private String vnfType; - private String vfModuleType; - private String vfModuleModelName; - private String networkType; - private String asdcServiceModelVersion; - private String requestScope; - private int reqVersion; - private boolean aLaCarteFlag; - private Platform platform; - private LineOfBusiness lineOfBusiness; - private Project project; - private OwningEntity owningEntity; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager (); - - MsoRequest (String requestId) { - this.requestId = requestId; - this.startTime = System.currentTimeMillis(); - MsoLogger.setLogContext (requestId, null); - - } - - MsoRequest () { - - this.startTime = System.currentTimeMillis(); - MsoLogger.setLogContext (requestId, null); - - } - - - public Response buildServiceErrorResponse (int httpResponseCode, - MsoException exceptionType, - String text, - String messageId, - List variables) { - - this.errorCode = messageId; - - if (text != null) { - this.errorMessage = text; - } - else { - this.errorMessage = ""; - } - this.httpResponse = Integer.toString(httpResponseCode); - if(errorMessage.length() > 1999){ - errorMessage = errorMessage.substring(0, 1999); - } - - RequestError re = new RequestError(); - - if("PolicyException".equals(exceptionType.name())){ - - PolicyException pe = new PolicyException(); - pe.setMessageId(messageId); - pe.setText(text); - if(variables != null){ - for(String variable: variables){ - pe.getVariables().add(variable); - } - } - re.setPolicyException(pe); - - } else { - - ServiceException se = new ServiceException(); - se.setMessageId(messageId); - se.setText(text); - if(variables != null){ - for(String variable: variables){ - se.getVariables().add(variable); - } - } - re.setServiceException(se); - } - - String requestErrorStr = null; - - try{ - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_DEFAULT); - requestErrorStr = mapper.writeValueAsString(re); - }catch(Exception e){ - msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in buildServiceErrorResponse writing exceptionType to string ", e); - } - - - return Response.status (httpResponseCode).entity(requestErrorStr).build (); - - } - - private int reqVersionToInt(String version){ - if(version!=null){ - return Integer.parseInt(version.substring(1)); - }else{ - return 0; - } - } - - // Parse request JSON - void parse (ServiceInstancesRequest sir, HashMap instanceIdMap, Action action, String version, String originalRequestJSON) throws ValidationException { - - msoLogger.debug ("Validating the Service Instance request"); - - this.sir = sir; - this.action = action; - this.reqVersion = reqVersionToInt(version); - this.originalRequestJSON = originalRequestJSON; - msoLogger.debug ("Incoming version is: " + version + " coverting to int: " + this.reqVersion); - - if(instanceIdMap != null){ - if(instanceIdMap.get("serviceInstanceId") != null){ - if (!UUIDChecker.isValidUUID (instanceIdMap.get ("serviceInstanceId"))) { - throw new ValidationException ("serviceInstanceId"); - } - this.sir.setServiceInstanceId(instanceIdMap.get("serviceInstanceId")); - } - - if(instanceIdMap.get("vnfInstanceId") != null){ - if (!UUIDChecker.isValidUUID (instanceIdMap.get ("vnfInstanceId"))) { - throw new ValidationException ("vnfInstanceId"); - } - this.sir.setVnfInstanceId(instanceIdMap.get("vnfInstanceId")); - } - - if(instanceIdMap.get("vfModuleInstanceId") != null){ - if (!UUIDChecker.isValidUUID (instanceIdMap.get ("vfModuleInstanceId"))) { - throw new ValidationException ("vfModuleInstanceId"); - } - this.sir.setVfModuleInstanceId(instanceIdMap.get("vfModuleInstanceId")); - } - - if(instanceIdMap.get("volumeGroupInstanceId") != null){ - if (!UUIDChecker.isValidUUID (instanceIdMap.get ("volumeGroupInstanceId"))) { - throw new ValidationException ("volumeGroupInstanceId"); - } - this.sir.setVolumeGroupInstanceId(instanceIdMap.get("volumeGroupInstanceId")); - } - - if(instanceIdMap.get("networkInstanceId") != null){ - if (!UUIDChecker.isValidUUID (instanceIdMap.get ("networkInstanceId"))) { - throw new ValidationException ("networkInstanceId"); - } - this.sir.setNetworkInstanceId(instanceIdMap.get("networkInstanceId")); - } - - if(instanceIdMap.get("configurationInstanceId") != null){ - if (!UUIDChecker.isValidUUID (instanceIdMap.get ("configurationInstanceId"))) { - throw new ValidationException ("configurationInstanceId"); - } - this.sir.setConfigurationId(instanceIdMap.get("configurationInstanceId")); - } - } - - if(reqVersion >= 6 && (action == Action.inPlaceSoftwareUpdate || action == Action.applyUpdatedConfig)){ - parsePayload(sir, action); - } - else{ - - RequestParameters requestParameters = sir.getRequestDetails().getRequestParameters(); - - this.modelInfo = sir.getRequestDetails().getModelInfo(); - - if (this.modelInfo == null) { - throw new ValidationException ("model-info"); - } - - this.requestInfo = sir.getRequestDetails().getRequestInfo(); - - if (this.requestInfo == null) { - throw new ValidationException ("requestInfo"); - } - - if (modelInfo.getModelType () == null) { - throw new ValidationException ("modelType"); - } - - this.requestScope = modelInfo.getModelType().name(); - - if(this.reqVersion >= 4){ - if(Action.addRelationships.equals(action) || Action.removeRelationships.equals(action)) { - if(requestParameters == null || requestParameters.getALaCarte() == null) { - throw new ValidationException ("aLaCarte in requestParameters"); - } - } - } - - if(requestParameters != null){ - if(requestScope.equalsIgnoreCase(ModelType.vnf.name())){ - if(action == Action.createInstance){ - if(requestParameters.getAutoBuildVfModules() == null){ - requestParameters.setAutoBuildVfModules(false); - } - } - if(action == Action.deleteInstance){ - if(requestParameters.getCascadeDelete() == null){ - requestParameters.setCascadeDelete(false); - } - } - if(action == Action.updateInstance){ - if(requestParameters.isUsePreload() == null){ - requestParameters.setUsePreload(true); - } - } - if(action == Action.replaceInstance){ - if(requestParameters.rebuildVolumeGroups() == null){ - requestParameters.setRebuildVolumeGroups(false); - } - } - } - if(requestScope.equalsIgnoreCase(ModelType.vfModule.name())){ - if(action == Action.createInstance || action == Action.updateInstance){ - if(requestParameters.isUsePreload() == null){ - requestParameters.setUsePreload(true); - } - } - } - if(this.reqVersion >= 4){ - if(requestParameters.getALaCarte() != null){ - this.aLaCarteFlag = requestParameters.getALaCarte(); - } - if(requestScope.equalsIgnoreCase(ModelType.service.name())){ - if(action == Action.createInstance || action == Action.deleteInstance || action == Action.activateInstance || action == Action.deactivateInstance){ - if(requestParameters.getALaCarte() == null){ - requestParameters.setaLaCarte(false); - this.aLaCarteFlag = requestParameters.getALaCarte(); - } - } - } - }else{ - this.aLaCarteFlag = true; - } - } - if(reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.createInstance){ - parsePlatformAndLineOfBusiness(sir); - } - // modelCustomizationId is required when usePreLoad is false for v4 and higher for VF Module Create - if(requestParameters != null && reqVersion >= 4 && requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.createInstance && !requestParameters.isUsePreload()) { - if(!UUIDChecker.isValidUUID(modelInfo.getModelCustomizationId())) { - throw new ValidationException("modelCustomizationId"); - } - } - - // modelCustomizationId is required for v5 and higher for VF Module Replace - if(requestParameters != null && reqVersion > 4 && requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.replaceInstance) { - if(!UUIDChecker.isValidUUID(modelInfo.getModelCustomizationId())) { - throw new ValidationException("modelCustomizationId"); - } - } - - // modelCustomizationId or modelCustomizationName are required for VNF Replace - if(requestParameters != null && reqVersion > 4 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.replaceInstance) { - if(!UUIDChecker.isValidUUID(modelInfo.getModelCustomizationId()) && modelInfo.getModelCustomizationName() == null) { - throw new ValidationException("modelCustomizationId or modelCustomizationName"); - } - } - - //is required for serviceInstance delete macro when aLaCarte=false (v3) - //create and updates except for network (except v4) - if (empty (modelInfo.getModelInvariantId ()) && ((this.reqVersion >2 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) || - !(this.reqVersion < 4 && requestScope.equalsIgnoreCase (ModelType.network.name ())) && - (action == Action.createInstance || action == Action.updateInstance || action == Action.enablePort || action == Action.disablePort || action == Action.addRelationships || action == Action.removeRelationships || - (requestScope.equalsIgnoreCase(ModelType.configuration.name()) && (action == Action.activateInstance || action == Action.deactivateInstance))))) { - throw new ValidationException ("modelInvariantId"); - } - - if (!empty (modelInfo.getModelInvariantId ()) && !UUIDChecker.isValidUUID (modelInfo.getModelInvariantId ())) { - throw new ValidationException ("modelInvariantId format"); - } - - if(this.reqVersion >= 4 && !(requestScope.equalsIgnoreCase(ModelType.configuration.name())) && empty (modelInfo.getModelName ()) && (action == Action.createInstance || action == Action.updateInstance || - action == Action.addRelationships || action == Action.removeRelationships || (action == Action.deleteInstance && (requestScope.equalsIgnoreCase (ModelType.vfModule.name ()))))){ - throw new ValidationException ("modelName"); - } - - if (empty (modelInfo.getModelVersion ()) && !(requestScope.equalsIgnoreCase(ModelType.configuration.name())) && - (!(this.reqVersion < 4 && requestScope.equalsIgnoreCase (ModelType.network.name ())) - && (action == Action.createInstance || action == Action.updateInstance || action == Action.addRelationships || action == Action.removeRelationships))) { - throw new ValidationException ("modelVersion"); - } - - // is required for serviceInstance delete macro when aLaCarte=false in v4 - if (this.reqVersion >= 4 && empty (modelInfo.getModelVersionId()) && ((!this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) || - (action == Action.createInstance || action == Action.updateInstance || action == Action.enablePort || action == Action.disablePort || action == Action.addRelationships || action == Action.removeRelationships || - (requestScope.equalsIgnoreCase(ModelType.configuration.name()) && (action == Action.activateInstance || action == Action.deactivateInstance))))) { - throw new ValidationException ("modelVersionId"); - } - - if(requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action != Action.deleteInstance && empty (modelInfo.getModelCustomizationName ())) { - if (!UUIDChecker.isValidUUID (modelInfo.getModelCustomizationId())) { - throw new ValidationException ("modelCustomizationId or modelCustomizationName"); - } - } - - if(this.reqVersion >= 4 && (!UUIDChecker.isValidUUID (modelInfo.getModelCustomizationId())) && (requestScope.equalsIgnoreCase (ModelType.network.name ()) || requestScope.equalsIgnoreCase(ModelType.configuration.name())) - && (action == Action.updateInstance || action == Action.createInstance)){ - throw new ValidationException ("modelCustomizationId"); - } - - if(!empty(modelInfo.getModelNameVersionId())){ - modelInfo.setModelVersionId(modelInfo.getModelNameVersionId()); - } - - this.cloudConfiguration = sir.getRequestDetails ().getCloudConfiguration (); - if ( (((!this.aLaCarteFlag && requestScope.equalsIgnoreCase (ModelType.service.name ()) && this.reqVersion < 5) || - (!requestScope.equalsIgnoreCase (ModelType.service.name ())) && action != Action.updateInstance)) - && cloudConfiguration == null) { - throw new ValidationException ("cloudConfiguration"); - } - - if (cloudConfiguration != null) { - if (empty (cloudConfiguration.getLcpCloudRegionId ())) { - throw new ValidationException ("lcpCloudRegionId"); - } - if (empty (cloudConfiguration.getTenantId ()) && !(requestScope.equalsIgnoreCase(ModelType.configuration.name()))) { - throw new ValidationException ("tenantId"); - } - } - - - if (requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.createInstance) { - if (requestParameters == null) { - throw new ValidationException ("requestParameters"); - } - if (empty (requestParameters.getSubscriptionServiceType())) { - throw new ValidationException ("subscriptionServiceType"); - } - } - if(this.reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.createInstance){ - parseProjectAndOwningEntity(sir); - } - if (this.reqVersion > 4 && requestScope.equalsIgnoreCase (ModelType.service.name ()) && action == Action.createInstance) { - SubscriberInfo subscriberInfo = sir.getRequestDetails ().getSubscriberInfo(); - if (subscriberInfo == null) { - throw new ValidationException ("subscriberInfo"); - } - if (empty (subscriberInfo.getGlobalSubscriberId ())) { - throw new ValidationException ("globalSubscriberId"); - } - } - - if(requestScope.equalsIgnoreCase(ModelType.service.name())){ - this.serviceInstanceType = modelInfo.getModelName(); - } - - if(requestScope.equalsIgnoreCase(ModelType.network.name())){ - this.networkType = modelInfo.getModelName(); - } - - if (!empty (requestInfo.getInstanceName ())) { - if (!requestInfo.getInstanceName ().matches (Constants.VALID_INSTANCE_NAME_FORMAT)) { - throw new ValidationException ("instanceName format"); - } - } - - if (empty (requestInfo.getProductFamilyId ())) { - // Mandatory for vnf Create(aLaCarte=true), Network Create(aLaCarte=true) and network update - //Mandatory for macro request create service instance - if((requestScope.equalsIgnoreCase (ModelType.vnf.name ()) && action == Action.createInstance) || - (requestScope.equalsIgnoreCase (ModelType.network.name ()) && (action == Action.createInstance || action == Action.updateInstance)) || - (this.reqVersion > 3 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.createInstance)) { - throw new ValidationException ("productFamilyId"); - } - } - - //required for all operations in V4 - if(empty(requestInfo.getRequestorId()) && this.reqVersion >= 4) { - throw new ValidationException ("requestorId"); - } - - if (empty (requestInfo.getSource ())) { - throw new ValidationException ("source"); - } - - RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList(); - - String serviceModelName = null; - String vnfModelName = null; - String asdcServiceModelVersion = null; - String volumeGroupId = null; - boolean isRelatedServiceInstancePresent = false; - boolean isRelatedVnfInstancePresent = false; - boolean isSourceVnfPresent = false; - boolean isDestinationVnfPresent = false; - boolean isConnectionPointPresent = false; - - if (instanceList != null) { - for(RelatedInstanceList relatedInstanceList : instanceList){ - RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); - - ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo (); - if (relatedInstanceModelInfo == null) { - throw new ValidationException ("modelInfo in relatedInstance"); - } - - if (relatedInstanceModelInfo.getModelType () == null) { - throw new ValidationException ("modelType in relatedInstance"); - } - - if(empty(relatedInstance.getInstanceName ()) && ModelType.pnf.equals(relatedInstanceModelInfo.getModelType())) { - throw new ValidationException ("instanceName in relatedInstance for pnf modelType"); - } - - if (!empty (relatedInstance.getInstanceName ())) { - if (!relatedInstance.getInstanceName ().matches (Constants.VALID_INSTANCE_NAME_FORMAT)) { - throw new ValidationException ("instanceName format in relatedInstance"); - } - } - - if (empty (relatedInstance.getInstanceId ()) && !ModelType.pnf.equals(relatedInstanceModelInfo.getModelType())) { - throw new ValidationException ("instanceId in relatedInstance"); - } - - if (!empty(relatedInstance.getInstanceId ()) && !UUIDChecker.isValidUUID (relatedInstance.getInstanceId ())) { - throw new ValidationException ("instanceId format in relatedInstance"); - } - - - if (action != Action.deleteInstance) { - if(!( relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup) || - relatedInstanceModelInfo.getModelType().equals(ModelType.connectionPoint) || - relatedInstanceModelInfo.getModelType().equals(ModelType.pnf))) { - - if(empty (relatedInstanceModelInfo.getModelInvariantId ())) { - throw new ValidationException ("modelInvariantId in relatedInstance"); - } else if(this.reqVersion >= 4 && empty(relatedInstanceModelInfo.getModelVersionId ())) { - throw new ValidationException("modelVersionId in relatedInstance"); - } else if(empty(relatedInstanceModelInfo.getModelName ())) { - throw new ValidationException ("modelName in relatedInstance"); - } else if (empty (relatedInstanceModelInfo.getModelVersion ())) { - throw new ValidationException ("modelVersion in relatedInstance"); - } - } - - if (!empty (relatedInstanceModelInfo.getModelInvariantId ()) && - !UUIDChecker.isValidUUID (relatedInstanceModelInfo.getModelInvariantId ())) { - throw new ValidationException ("modelInvariantId format in relatedInstance"); - } - - if(ModelType.configuration.name().equalsIgnoreCase(requestScope)) { - if(InstanceDirection.source.equals(relatedInstance.getInstanceDirection()) && relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) { - isSourceVnfPresent = true; - } else if(InstanceDirection.destination.equals(relatedInstance.getInstanceDirection()) && - (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf) || (relatedInstanceModelInfo.getModelType().equals(ModelType.pnf) && this.reqVersion == 6))) { - isDestinationVnfPresent = true; - } - } - - if(ModelType.connectionPoint.equals(relatedInstanceModelInfo.getModelType()) && ModelType.configuration.name().equalsIgnoreCase(requestScope)) { - isConnectionPointPresent = true; - } - } - - if (empty (relatedInstanceModelInfo.getModelCustomizationName ()) && relatedInstanceModelInfo.getModelType ().equals (ModelType.vnf) ) { - if(this.reqVersion >=4 && empty (relatedInstanceModelInfo.getModelCustomizationId()) && action != Action.deleteInstance) { - throw new ValidationException ("modelCustomizationName or modelCustomizationId in relatedInstance of vnf"); - } - } - - if(relatedInstanceModelInfo.getModelType().equals(ModelType.service)) { - isRelatedServiceInstancePresent = true; - if (!relatedInstance.getInstanceId ().equals (this.sir.getServiceInstanceId ())) { - throw new ValidationException ("serviceInstanceId matching the serviceInstanceId in request URI"); - } - serviceModelName = relatedInstanceModelInfo.getModelName (); - asdcServiceModelVersion = relatedInstanceModelInfo.getModelVersion (); - } else if(relatedInstanceModelInfo.getModelType().equals(ModelType.vnf) && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) { - isRelatedVnfInstancePresent = true; - if (!relatedInstance.getInstanceId ().equals (this.sir.getVnfInstanceId ())) { - throw new ValidationException ("vnfInstanceId matching the vnfInstanceId in request URI"); - } - vnfModelName = relatedInstanceModelInfo.getModelCustomizationName(); - } else if(relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) { - volumeGroupId = relatedInstance.getInstanceId (); - } - } - - if(action == Action.createInstance && ModelType.configuration.name().equalsIgnoreCase(requestScope)) { - if(!isSourceVnfPresent) { - throw new ValidationException ("source vnf relatedInstance for Port Configuration"); - } - - if(!isDestinationVnfPresent) { - throw new ValidationException ("destination vnf relatedInstance for Port Configuration"); - } - } - - if((action == Action.enablePort || action == Action.disablePort) && ModelType.configuration.name().equalsIgnoreCase(requestScope)) { - if(!isConnectionPointPresent) { - throw new ValidationException ("connectionPoint relatedInstance for Port Configuration"); - } - } - - if(requestScope.equalsIgnoreCase (ModelType.volumeGroup.name ())) { - if (!isRelatedServiceInstancePresent) { - throw new ValidationException ("related service instance for volumeGroup request"); - } - if (!isRelatedVnfInstancePresent) { - throw new ValidationException ("related vnf instance for volumeGroup request"); - } - this.serviceInstanceType = serviceModelName; - this.vnfType = serviceModelName + "/" + vnfModelName; - this.asdcServiceModelVersion = asdcServiceModelVersion; - } - else if(requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) { - if (!isRelatedServiceInstancePresent) { - throw new ValidationException ("related service instance for vfModule request"); - } - if (!isRelatedVnfInstancePresent) { - throw new ValidationException ("related vnf instance for vfModule request"); - } - String vfModuleModelName = modelInfo.getModelName (); - this.vfModuleModelName = vfModuleModelName; - this.serviceInstanceType = serviceModelName; - this.vnfType = serviceModelName + "/" + vnfModelName; - this.asdcServiceModelVersion = asdcServiceModelVersion; - this.vfModuleType = vnfType + "::" + vfModuleModelName; - this.sir.setVolumeGroupInstanceId (volumeGroupId); - } - else if (requestScope.equalsIgnoreCase (ModelType.vnf.name ())) { - if (!isRelatedServiceInstancePresent) { - throw new ValidationException ("related service instance for vnf request"); - } - this.vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName(); - } - } - else if ((( requestScope.equalsIgnoreCase(ModelType.vnf.name ()) || requestScope.equalsIgnoreCase(ModelType.volumeGroup.name ()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name ()) - || requestScope.equalsIgnoreCase(ModelType.configuration.name())) && (action == Action.createInstance || action == Action.enablePort || action == Action.disablePort)) || - (this.reqVersion >= 4 && (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name ()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) && action == Action.updateInstance) || - (requestScope.equalsIgnoreCase(ModelType.service.name()) && (action.equals(Action.addRelationships) || action.equals(Action.removeRelationships)))){ - msoLogger.debug ("related instance exception"); - throw new ValidationException ("related instances"); - } - } - } - void parsePayload(ServiceInstancesRequest sir, Action action) throws ValidationException{ - msoLogger.debug("Validating for requestParameters and payload"); - this.sir = sir; - this.action = action; - this.requestScope = ModelType.vnf.name(); - RequestParameters requestParameters = sir.getRequestDetails().getRequestParameters(); - this.cloudConfiguration = sir.getRequestDetails ().getCloudConfiguration(); - this.requestInfo = sir.getRequestDetails().getRequestInfo(); - - if(action == Action.inPlaceSoftwareUpdate){ - if (cloudConfiguration == null) { - throw new ValidationException ("cloudConfiguration"); - }else if (empty (cloudConfiguration.getLcpCloudRegionId ())) { - throw new ValidationException ("lcpCloudRegionId"); - }else if (empty (cloudConfiguration.getTenantId ())) { - throw new ValidationException ("tenantId"); - } - } - if(requestInfo == null){ - throw new ValidationException("requestInfo"); - }else if(empty(requestInfo.getRequestorId())) { - throw new ValidationException ("requestorId"); - }else if (empty (requestInfo.getSource ())) { - throw new ValidationException ("source"); - } - if(requestParameters == null){ - throw new ValidationException("requestParameters"); - } - } - void parsePlatformAndLineOfBusiness(ServiceInstancesRequest sir) throws ValidationException { - msoLogger.debug("Validating Platform and LineOfBusiness Objects"); - this.sir = sir; - platform = sir.getRequestDetails().getPlatform(); - lineOfBusiness = sir.getRequestDetails().getLineOfBusiness(); - - if(this.reqVersion > 5 && platform == null) { - throw new ValidationException("platform"); - } - - if(platform != null && empty(platform.getPlatformName())){ - throw new ValidationException("platformName"); - } - - if(lineOfBusiness != null && empty(lineOfBusiness.getLineOfBusinessName())){ - throw new ValidationException("lineOfBusinessName"); - } - } - - void parseProjectAndOwningEntity(ServiceInstancesRequest sir) throws ValidationException { - msoLogger.debug("Validating Project and OwningEntity Objects"); - this.sir = sir; - this.project = sir.getRequestDetails().getProject(); - this.owningEntity = sir.getRequestDetails().getOwningEntity(); - - if(this.reqVersion > 5 && owningEntity == null) { - throw new ValidationException("owningEntity"); - } - - if(owningEntity != null && empty(owningEntity.getOwningEntityId())){ - throw new ValidationException("owningEntityId"); - } - - if(project != null && empty(project.getProjectName())){ - throw new ValidationException("projectName"); - } - } - - void parseOrchestration (ServiceInstancesRequest sir) throws ValidationException { - - msoLogger.debug ("Validating the Orchestration request"); - - this.sir = sir; - this.requestInfo = sir.getRequestDetails().getRequestInfo(); - - if (this.requestInfo == null) { - throw new ValidationException ("requestInfo"); - } - - if (empty (requestInfo.getSource ())) { - throw new ValidationException ("source"); - } - if (empty (requestInfo.getRequestorId ())) { - throw new ValidationException ("requestorId"); - } - } - - public Map> getOrchestrationFilters (MultivaluedMap queryParams) throws ValidationException { - - String queryParam = null; - Map> orchestrationFilterParams = new HashMap<>(); - - - for (Entry> entry : queryParams.entrySet()) { - queryParam = entry.getKey(); - - try{ - if("filter".equalsIgnoreCase(queryParam)){ - for(String value : entry.getValue()) { - StringTokenizer st = new StringTokenizer(value, ":"); - - int counter=0; - String mapKey=null; - List orchestrationList = new ArrayList<>(); - while (st.hasMoreElements()) { - if(counter == 0){ - mapKey = st.nextElement() + ""; - } else{ - orchestrationList.add(st.nextElement() + ""); - } - counter++; - } - orchestrationFilterParams.put(mapKey, orchestrationList); - } - } - - }catch(Exception e){ - //msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, e); - throw new ValidationException ("QueryParam ServiceInfo", e); - - } - - } - - - return orchestrationFilterParams; - } - - public void createRequestRecord (Status status, Action action) { - - Session session = null; - try { - - session = requestsDbSessionFactoryManager.getSessionFactory ().openSession (); - session.beginTransaction (); - - if (null == sir) { - sir = new ServiceInstancesRequest (); - } - - InfraActiveRequests aq = new InfraActiveRequests (); - aq.setRequestId (requestId); - - aq.setRequestAction(action.name()); - aq.setAction(action.name()); - - Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis()); - - aq.setStartTime (startTimeStamp); - - if (requestInfo != null) { - - if(requestInfo.getSource() != null){ - aq.setSource(requestInfo.getSource()); - } - if(requestInfo.getCallbackUrl() != null){ - aq.setCallBackUrl(requestInfo.getCallbackUrl()); - } - if(requestInfo.getCorrelator() != null){ - aq.setCorrelator(requestInfo.getCorrelator()); - } - - if(requestInfo.getRequestorId() != null) { - aq.setRequestorId(requestInfo.getRequestorId()); - } - } - - if (modelInfo != null || (action == Action.inPlaceSoftwareUpdate || action == Action.applyUpdatedConfig)) { - aq.setRequestScope(requestScope); - } - - if (cloudConfiguration != null) { - if(cloudConfiguration.getLcpCloudRegionId() != null) { - aq.setAicCloudRegion(cloudConfiguration.getLcpCloudRegionId()); - } - - if(cloudConfiguration.getTenantId() != null) { - aq.setTenantId(cloudConfiguration.getTenantId()); - } - - } - - if(sir.getServiceInstanceId() != null){ - aq.setServiceInstanceId(sir.getServiceInstanceId()); - } - - if(sir.getVnfInstanceId() != null){ - aq.setVnfId(sir.getVnfInstanceId()); - } - - - if(ModelType.service.name().equalsIgnoreCase(requestScope)){ - if(requestInfo.getInstanceName() != null){ - aq.setServiceInstanceName(requestInfo.getInstanceName()); - } - } - - if(ModelType.network.name().equalsIgnoreCase(requestScope)){ - aq.setNetworkName(requestInfo.getInstanceName()); - aq.setNetworkType(networkType); - aq.setNetworkId(sir.getNetworkInstanceId()); - } - - if(ModelType.volumeGroup.name().equalsIgnoreCase(requestScope)){ - aq.setVolumeGroupId(sir.getVolumeGroupInstanceId()); - aq.setVolumeGroupName(requestInfo.getInstanceName()); - aq.setVnfType(vnfType); - - } - - if(ModelType.vfModule.name().equalsIgnoreCase(requestScope)){ - aq.setVfModuleName(requestInfo.getInstanceName()); - aq.setVfModuleModelName(modelInfo.getModelName()); - aq.setVfModuleId(sir.getVfModuleInstanceId()); - aq.setVolumeGroupId(sir.getVolumeGroupInstanceId()); - aq.setVnfType(vnfType); - - } - - if(ModelType.configuration.name().equalsIgnoreCase(requestScope)) { - aq.setConfigurationId(sir.getConfigurationId()); - aq.setConfigurationName(requestInfo.getInstanceName()); - } - - if(ModelType.vnf.name().equalsIgnoreCase(requestScope)){ - aq.setVnfName(requestInfo.getInstanceName()); - if (null != sir.getRequestDetails()) { - RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList(); - - if (instanceList != null) { - - for(RelatedInstanceList relatedInstanceList : instanceList){ - - RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); - if(relatedInstance.getModelInfo().getModelType().equals(ModelType.service)){ - aq.setVnfType(vnfType); - } - } - } - } - } - - aq.setRequestBody (this.originalRequestJSON); - - aq.setRequestStatus (status.toString ()); - aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER); - - if ((status == Status.FAILED) || (status == Status.COMPLETE)) { - aq.setStatusMessage (this.errorMessage); - aq.setResponseBody (this.responseBody); - aq.setProgress(new Long(100)); - Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis()); - aq.setEndTime (endTimeStamp); - } - - msoLogger.debug ("About to insert a record"); - - session.save (aq); - session.getTransaction ().commit (); - session.close (); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request", e); - if (session != null) { - session.close (); - } - if (!status.equals (Status.FAILED)) { - throw e; - } - } - } - - public void updateFinalStatus (Status status) { - try { - (RequestsDatabase.getInstance()).updateInfraFinalStatus (requestId, - status.toString (), - this.errorMessage, - this.progress, - this.responseBody, - Constants.MODIFIED_BY_APIHANDLER); - } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception when updating record in DB"); - msoLogger.debug ("Exception: ", e); - } - } - - public Response buildResponse (int httpResponseCode, String errorCode, InfraActiveRequests inProgress) { - return buildResponseWithError (httpResponseCode, errorCode, inProgress, null); - } - - public Response buildResponseWithError (int httpResponseCode, - String errorCode, - InfraActiveRequests inProgress, - String errorString) { - - - - // Log the failed request into the MSO Requests database - - return Response.status (httpResponseCode).entity (null).build (); - - } - - public Response buildResponseFailedValidation (int httpResponseCode, String exceptionMessage) { - - - - return Response.status (httpResponseCode).entity (null).build (); - } - - public Platform getPlatform(){ - return platform; - } - - public void setPlatform(Platform value){ - this.platform = value; - } - - public LineOfBusiness getLineOfBusiness(){ - return lineOfBusiness; - } - - public void setLineOfBusiness(LineOfBusiness value){ - this.lineOfBusiness = value; - } - - public Project getProject(){ - return project; - } - public void setProject(Project value){ - this.project = value; - } - public OwningEntity getOwningEntity(){ - return owningEntity; - } - public void setOwningEntity(OwningEntity value){ - this.owningEntity = value; - } - public String getRequestUri () { - return requestUri; - } - - public void setRequestUri (String requestUri) { - this.requestUri = requestUri; - } - - public VnfInputs getVnfInputs () { - return vnfInputs; - } - - public RequestInfo getRequestInfo () { - return requestInfo; - } - - public String getResponseBody () { - return responseBody; - } - - public void setResponseBody (String responseBody) { - this.responseBody = responseBody; - } - - public String getHttpResponse () { - return httpResponse; - } - - public void setHttpResponse (String httpResponse) { - this.httpResponse = httpResponse; - } - - public String getRequestId () { - return requestId; - } - - public String getRequestXML () { - return requestXML; - } - - public void setRequestXML (String requestXML) { - this.requestXML = requestXML; - } - - public RequestStatusType getStatus () { - return status; - } - - public String getServiceType () { - if (this.vnfInputs.getServiceType () != null) - return this.vnfInputs.getServiceType (); - if (this.vnfInputs.getServiceId () != null) - return this.vnfInputs.getServiceId (); - return null; - } - - public void setStatus (RequestStatusType status) { - this.status = status; - switch (status) { - case FAILED: - case COMPLETE: - this.progress = Constants.PROGRESS_REQUEST_COMPLETED; - break; - case IN_PROGRESS: - this.progress = Constants.PROGRESS_REQUEST_IN_PROGRESS; - break; - } - } - - public ModelInfo getModelInfo() { - return modelInfo; - } - - public ServiceInstancesRequest getServiceInstancesRequest() { - return sir; - } - - public String getServiceInstanceType () { - return serviceInstanceType; - } - - public String getNetworkType () { - return networkType; - } - - public String getVnfType () { - return vnfType; - } - - public String getVfModuleModelName () { - return vfModuleModelName; - } - - public String getVfModuleType () { - return vfModuleType; - } - - public String getAsdcServiceModelVersion () { - return asdcServiceModelVersion; - } - - public static String domToStr (Document doc) { - if (doc == null) { - return null; - } - - try { - StringWriter sw = new StringWriter (); - StreamResult sr = new StreamResult (sw); - TransformerFactory tf = TransformerFactory.newInstance (); - Transformer t = tf.newTransformer (); - t.setOutputProperty (OutputKeys.STANDALONE, "yes"); - NodeList nl = doc.getDocumentElement ().getChildNodes (); - DOMSource source = null; - for (int x = 0; x < nl.getLength (); x++) { - Node e = nl.item (x); - if (e instanceof Element) { - source = new DOMSource (e); - break; - } - } - if (source != null) { - t.transform (source, sr); - - String s = sw.toString (); - return s; - } - - return null; - - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DOM2STR_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in domToStr", e); - } - return null; - } - - public void addBPMNSpecificInputs(String personaModelId, String personaModelVersion, Boolean isBaseVfModule, - String vnfPersonaModelId, String vnfPersonaModelVersion) { - vnfInputs.setPersonaModelId(personaModelId); - vnfInputs.setPersonaModelVersion(personaModelVersion); - vnfInputs.setIsBaseVfModule(isBaseVfModule); - vnfInputs.setVnfPersonaModelId(vnfPersonaModelId); - vnfInputs.setVnfPersonaModelVersion(vnfPersonaModelVersion); - - this.vnfReq.setVnfInputs(vnfInputs); - - StringWriter stringWriter = new StringWriter (); - try { - JAXBContext jaxbContext = JAXBContext.newInstance (VnfRequest.class); - Marshaller jaxbMarshaller = jaxbContext.createMarshaller (); - - // output pretty printed - jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true); - - jaxbMarshaller.marshal (this.vnfReq, stringWriter); - - } catch (JAXBException e) { - msoLogger.debug ("Exception: ", e); - } - - this.requestXML = stringWriter.toString (); - msoLogger.debug("REQUEST XML to BPEL: " + this.requestXML); - - - } - - private static boolean empty(String s) { - return (s == null || s.trim().isEmpty()); - } - - public String getRequestJSON() throws JsonGenerationException, JsonMappingException, IOException { - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - //mapper.configure(Feature.WRAP_ROOT_VALUE, true); - msoLogger.debug ("building sir from object " + sir); - String requestJSON = mapper.writeValueAsString(sir); - - // Perform mapping from VID-style modelInfo fields to ASDC-style modelInfo fields - - msoLogger.debug("REQUEST JSON before mapping: " + requestJSON); - // modelUuid = modelVersionId - requestJSON = requestJSON.replaceAll("\"modelVersionId\":","\"modelUuid\":"); - // modelCustomizationUuid = modelCustomizationId - requestJSON = requestJSON.replaceAll("\"modelCustomizationId\":","\"modelCustomizationUuid\":"); - // modelInstanceName = modelCustomizationName - requestJSON = requestJSON.replaceAll("\"modelCustomizationName\":","\"modelInstanceName\":"); - // modelInvariantUuid = modelInvariantId - requestJSON = requestJSON.replaceAll("\"modelInvariantId\":","\"modelInvariantUuid\":"); - msoLogger.debug("REQUEST JSON after mapping: " + requestJSON); - - return requestJSON; - } - - public boolean getALaCarteFlag() { - return aLaCarteFlag; - } - - public void setaLaCarteFlag(boolean aLaCarteFlag) { - this.aLaCarteFlag = aLaCarteFlag; - } - - public int getReqVersion() { - return reqVersion; - } - - public void setReqVersion(int reqVersion) { - this.reqVersion = reqVersion; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java deleted file mode 100644 index 3a7235d370..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - -import javax.ws.rs.GET; -import javax.ws.rs.HEAD; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; - -import org.openecomp.mso.HealthCheckUtils; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.utils.UUIDChecker; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; - -@Path("/nodehealthcheck") -@Api(value="/nodehealthcheck",description="API Handler Infra Node Health Check") -public class NodeHealthcheckHandler { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - - @HEAD - @GET - @Produces("text/html") - @ApiOperation(value="Performing node health check",response=Response.class) - public Response nodeHealthcheck () { - long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("NodeHealthcheck"); - // Generate a Request Id - String requestId = UUIDChecker.generateUUID(msoLogger); - HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck (msoLogger)) { - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - - if (healthCheck.verifyNodeHealthCheck(HealthCheckUtils.NodeType.APIH, requestId)) { - msoLogger.debug("nodeHealthcheck - Successful"); - return HealthCheckUtils.HEALTH_CHECK_RESPONSE; - } else { - msoLogger.debug("nodeHealthcheck - At leaset one of the sub-modules is not available."); - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java deleted file mode 100644 index 216a7ba43b..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java +++ /dev/null @@ -1,376 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.apihandlerinfra; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import org.apache.http.HttpStatus; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.mso.apihandler.common.ErrorNumbers; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.InfraActiveRequests; -import org.openecomp.mso.requestsdb.RequestsDatabase; -import org.openecomp.mso.serviceinstancebeans.GetOrchestrationListResponse; -import org.openecomp.mso.serviceinstancebeans.GetOrchestrationResponse; -import org.openecomp.mso.serviceinstancebeans.InstanceReferences; -import org.openecomp.mso.serviceinstancebeans.Request; -import org.openecomp.mso.serviceinstancebeans.RequestDetails; -import org.openecomp.mso.serviceinstancebeans.RequestList; -import org.openecomp.mso.serviceinstancebeans.RequestStatus; -import org.openecomp.mso.serviceinstancebeans.ServiceInstancesRequest; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; - -@Path("/orchestrationRequests") -@Api(value="/orchestrationRequests",description="API Requests for Orchestration requests") -public class OrchestrationRequests { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); - - private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); - - /** - * - */ - public OrchestrationRequests() { - // TODO Auto-generated constructor stub - } - - @GET - @Path("/{version:[vV][4-6]}/{requestId}") - @ApiOperation(value="Find Orchestrated Requests for a given requestId",response=Response.class) - @Produces(MediaType.APPLICATION_JSON) - public Response getOrchestrationRequest(@PathParam("requestId") String requestId, @PathParam("version") String version) { - - GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse(); - - MsoRequest msoRequest = new MsoRequest (requestId); - - long startTime = System.currentTimeMillis (); - - InfraActiveRequests requestDB = null; - - try { - requestDB = requestsDB.getRequestFromInfraActive(requestId); - - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - e.getMessage (), - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - - } - - if(requestDB == null) { - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NO_CONTENT, - MsoException.ServiceException, - "Orchestration RequestId " + requestId + " is not found in DB", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - - } - - Request request = mapInfraActiveRequestToRequest(requestDB); - - orchestrationResponse.setRequest(request); - - return Response.status(200).entity(orchestrationResponse).build(); - } - - @GET - @Path("/{version:[vV][4-6]}") - @ApiOperation(value="Find Orchestrated Requests for a URI Information",response=Response.class) - @Produces(MediaType.APPLICATION_JSON) - public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version) { - - long startTime = System.currentTimeMillis (); - - MsoRequest msoRequest = new MsoRequest(); - - MultivaluedMap queryParams = ui.getQueryParameters(); - - List activeRequests = null; - - GetOrchestrationListResponse orchestrationList = null; - - - try{ - - Map> orchestrationMap = msoRequest.getOrchestrationFilters(queryParams); - - activeRequests = requestsDB.getOrchestrationFiltersFromInfraActive(orchestrationMap); - - orchestrationList = new GetOrchestrationListResponse(); - - List requestLists = new ArrayList<>(); - - for(InfraActiveRequests infraActive : activeRequests){ - - Request request = mapInfraActiveRequestToRequest(infraActive); - RequestList requestList = new RequestList(); - requestList.setRequest(request); - - requestLists.add(requestList); - - } - - orchestrationList.setRequestList(requestLists); - - }catch(Exception e){ - msoLogger.debug ("Get Orchestration Request with Filters Failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, - "Get Orchestration Request with Filters Failed. " + e.getMessage(), - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null); - msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Get Orchestration Request with Filters Failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - - return Response.status(200).entity(orchestrationList).build(); - } - - - @POST - @Path("/{version: [vV][4-6]}/{requestId}/unlock") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Unlock Orchestrated Requests for a given requestId",response=Response.class) - public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) { - - MsoRequest msoRequest = new MsoRequest (requestId); - - long startTime = System.currentTimeMillis (); - msoLogger.debug ("requestId is: " + requestId); - - InfraActiveRequests requestDB = null; - Request request = null; - - msoLogger.debug ("requestId is: " + requestId); - ServiceInstancesRequest sir = null; - - try{ - ObjectMapper mapper = new ObjectMapper(); - sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - - } catch(Exception e){ - msoLogger.debug ("Mapping of request to JSON object failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Mapping of request to JSON object failed. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Mapping of request to JSON object failed"); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - - try{ - msoRequest.parseOrchestration(sir); - } catch (Exception e) { - msoLogger.debug ("Validation failed: ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Error parsing request. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Logging failed message to the database"); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - try { - requestDB = requestsDB.getRequestFromInfraActive(requestId); - - if(requestDB == null) { - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "Orchestration RequestId " + requestId + " is not found in DB", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - - }else{ - request = mapInfraActiveRequestToRequest(requestDB); - RequestStatus reqStatus = request.getRequestStatus(); - Status status = Status.valueOf(reqStatus.getRequestState()); - if(status == Status.IN_PROGRESS || status == Status.PENDING || status == Status.PENDING_MANUAL_TASK){ - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED); - reqStatus.setRequestState(Status.UNLOCKED.toString ()); - requestsDB.updateInfraStatus (requestId, - Status.UNLOCKED.toString (), - Constants.MODIFIED_BY_APIHANDLER); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "RequestId " + requestId + " has been unlocked"); - - }else{ - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, - "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - } - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - e.getMessage (), - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - - } - - return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build (); - } - - private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) { - - - Request request = new Request(); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - - request.setRequestId(requestDB.getRequestId()); - request.setRequestScope(requestDB.getRequestScope()); - request.setRequestType(requestDB.getRequestAction()); - - InstanceReferences ir = new InstanceReferences(); - if(requestDB.getNetworkId() != null) - ir.setNetworkInstanceId(requestDB.getNetworkId()); - if(requestDB.getNetworkName() != null) - ir.setNetworkInstanceName(requestDB.getNetworkName()); - if(requestDB.getServiceInstanceId() != null) - ir.setServiceInstanceId(requestDB.getServiceInstanceId()); - if(requestDB.getServiceInstanceName() != null) - ir.setServiceInstanceName(requestDB.getServiceInstanceName()); - if(requestDB.getVfModuleId() != null) - ir.setVfModuleInstanceId(requestDB.getVfModuleId()); - if(requestDB.getVfModuleName() != null) - ir.setVfModuleInstanceName(requestDB.getVfModuleName()); - if(requestDB.getVnfId() != null) - ir.setVnfInstanceId(requestDB.getVnfId()); - if(requestDB.getVnfName() != null) - ir.setVnfInstanceName(requestDB.getVnfName()); - if(requestDB.getVolumeGroupId() != null) - ir.setVolumeGroupInstanceId(requestDB.getVolumeGroupId()); - if(requestDB.getVolumeGroupName() != null) - ir.setVolumeGroupInstanceName(requestDB.getVolumeGroupName()); - if(requestDB.getRequestorId() != null) - ir.setRequestorId(requestDB.getRequestorId()); - - - request.setInstanceReferences(ir); - - String requestBody = requestDB.getRequestBody(); - - RequestDetails requestDetails = null; - - try{ - requestDetails = mapper.readValue(requestBody, RequestDetails.class); - - }catch(Exception e){ - msoLogger.debug("Exception caught mapping requestBody to RequestDetails",e); - } - - request.setRequestDetails(requestDetails); - String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + " GMT"; - request.setStartTime(startTimeStamp); - - RequestStatus status = new RequestStatus(); - if(requestDB.getStatusMessage() != null){ - status.setStatusMessage(requestDB.getStatusMessage()); - } - - if(requestDB.getEndTime() != null){ - String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + " GMT"; - status.setFinishTime(endTimeStamp); - } - - - if(requestDB.getRequestStatus() != null){ - status.setRequestState(requestDB.getRequestStatus()); - } - - if(requestDB.getProgress() != null){ - status.setPercentProgress(requestDB.getProgress().intValue()); - } - - request.setRequestStatus(status); - - return request; - } - } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java deleted file mode 100644 index 2a02344ab3..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - - -public class RecipeLookupResult { - - private String orchestrationURI; - private int recipeTimeout; - // the service recipe param. - private String recipeParamXsd; - - public RecipeLookupResult(String orchestrationURI, int recipeTimeout) { - this.orchestrationURI = orchestrationURI; - this.recipeTimeout = recipeTimeout; - } - - public RecipeLookupResult(String orchestrationURI, int recipeTimeout, String recipeParamXsd) { - this.orchestrationURI = orchestrationURI; - this.recipeTimeout = recipeTimeout; - this.recipeParamXsd = recipeParamXsd; - } - - public String getOrchestrationURI () { - return orchestrationURI; - } - - public void setOrchestrationURI (String orchestrationURI) { - this.orchestrationURI = orchestrationURI; - } - - public int getRecipeTimeout () { - return recipeTimeout; - } - - public void setRecipeTimeout (int recipeTimeout) { - this.recipeTimeout = recipeTimeout; - } - - - /** - * @return Returns the recipeParamXsd. - */ - public String getRecipeParamXsd() { - return recipeParamXsd; - } - - - /** - * @param recipeParamXsd The recipeParamXsd to set. - */ - public void setRecipeParamXsd(String recipeParamXsd) { - this.recipeParamXsd = recipeParamXsd; - } - - -} - diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java deleted file mode 100644 index e68093e166..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - -import java.util.HashMap; -import java.util.Map; - -/* - * Map of actions to RequestActions -*/ -public class RequestActionMap { - private static final Map actionMap; - - static { - actionMap = new HashMap<>(); - actionMap.put("CREATE_VF_MODULE", "createInstance"); - actionMap.put("DELETE_VF_MODULE", "deleteInstance"); - actionMap.put("UPDATE_VF_MODULE", "updateInstance"); - actionMap.put("CREATE_VF_MODULE_VOL", "createInstance"); - actionMap.put("DELETE_VF_MODULE_VOL", "deleteInstance"); - actionMap.put("UPDATE_VF_MODULE_VOL", "updateInstance"); - actionMap.put("CREATE", "createInstance"); - actionMap.put("DELETE", "deleteInstance"); - actionMap.put("UPDATE", "updateInstance"); - actionMap.put("createInstance", "createInstance"); - actionMap.put("deleteInstance", "deleteInstance"); - actionMap.put("updateInstance", "updateInstance"); - actionMap.put("replaceInstance", "replaceInstance"); - - } - - public static String getMappedRequestAction(String action) { - return actionMap.get(action); - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java deleted file mode 100644 index 32a016fae5..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java +++ /dev/null @@ -1,1249 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.apihandlerinfra; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.apache.commons.lang.StringUtils; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.mso.apihandler.common.CommonConstants; -import org.openecomp.mso.apihandler.common.ErrorNumbers; -import org.openecomp.mso.apihandler.common.RequestClient; -import org.openecomp.mso.apihandler.common.RequestClientFactory; -import org.openecomp.mso.apihandler.common.RequestClientParamater; -import org.openecomp.mso.apihandler.common.ResponseHandler; -import org.openecomp.mso.apihandler.common.ValidationException; -import org.openecomp.mso.serviceinstancebeans.ModelInfo; -import org.openecomp.mso.serviceinstancebeans.ModelType; -import org.openecomp.mso.serviceinstancebeans.RelatedInstance; -import org.openecomp.mso.serviceinstancebeans.RelatedInstanceList; -import org.openecomp.mso.serviceinstancebeans.RequestParameters; -import org.openecomp.mso.serviceinstancebeans.RequestReferences; -import org.openecomp.mso.serviceinstancebeans.ServiceInstancesRequest; -import org.openecomp.mso.serviceinstancebeans.ServiceInstancesResponse; -import org.openecomp.mso.db.catalog.CatalogDatabase; -import org.openecomp.mso.db.catalog.beans.NetworkResource; -import org.openecomp.mso.db.catalog.beans.Recipe; -import org.openecomp.mso.db.catalog.beans.Service; -import org.openecomp.mso.db.catalog.beans.ServiceRecipe; -import org.openecomp.mso.db.catalog.beans.VfModule; -import org.openecomp.mso.db.catalog.beans.VfModuleCustomization; -import org.openecomp.mso.db.catalog.beans.VnfRecipe; -import org.openecomp.mso.db.catalog.beans.VnfResource; -import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.requestsdb.InfraActiveRequests; -import org.openecomp.mso.requestsdb.RequestsDatabase; -import org.openecomp.mso.utils.UUIDChecker; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; - -@Path("/serviceInstances") -@Api(value="/serviceInstances",description="API Requests for Service Instances") -public class ServiceInstances { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); - - @POST - @Path("/{version:[vV][4-6]}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Create a Service Instance on a version provided",response=Response.class) - public Response createServiceInstance(String request, @PathParam("version") String version) { - return serviceInstances(request, Action.createInstance, null, version); - } - - @POST - @Path("/{version:[vV][5-6]}/{serviceInstanceId}/activate") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Activate provided Service Instance",response=Response.class) - public Response activateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - return serviceInstances(request, Action.activateInstance, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][5-6]}/{serviceInstanceId}/deactivate") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Deactivate provided Service Instance",response=Response.class) - public Response deactivateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - return serviceInstances(request, Action.deactivateInstance, instanceIdMap, version); - } - - @DELETE - @Path("/{version:[vV][4-6]}/{serviceInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Delete provided Service Instance",response=Response.class) - public Response deleteServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - return serviceInstances(request, Action.deleteInstance, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][5-6]}/{serviceInstanceId}/configurations") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Create Port Mirroring Configuration",response=Response.class) - public Response createPortConfiguration(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - return configurationRecipeLookup(request, Action.createInstance, instanceIdMap, version); - } - - @DELETE - @Path("/{version:[vV][5-6]}/{serviceInstanceId}/configurations/{configurationInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Delete provided Port",response=Response.class) - public Response deletePortConfiguration(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("configurationInstanceId") String configurationInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("configurationInstanceId", configurationInstanceId); - return configurationRecipeLookup(request, Action.deleteInstance, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][5-6]}/{serviceInstanceId}/configurations/{configurationInstanceId}/enablePort") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Enable Port Mirroring",response=Response.class) - public Response enablePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("configurationInstanceId") String configurationInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("configurationInstanceId", configurationInstanceId); - return configurationRecipeLookup(request, Action.enablePort, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][5-6]}/{serviceInstanceId}/configurations/{configurationInstanceId}/disablePort") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Disable Port Mirroring",response=Response.class) - public Response disablePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("configurationInstanceId") String configurationInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("configurationInstanceId", configurationInstanceId); - return configurationRecipeLookup(request, Action.disablePort, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][5-6]}/{serviceInstanceId}/configurations/{configurationInstanceId}/activate") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Activate Port Mirroring",response=Response.class) - public Response activatePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("configurationInstanceId") String configurationInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("configurationInstanceId", configurationInstanceId); - return configurationRecipeLookup(request, Action.activateInstance, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][5-6]}/{serviceInstanceId}/configurations/{configurationInstanceId}/deactivate") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Deactivate Port Mirroring",response=Response.class) - public Response deactivatePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("configurationInstanceId") String configurationInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("configurationInstanceId", configurationInstanceId); - return configurationRecipeLookup(request, Action.deactivateInstance, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][6]}/{serviceInstanceId}/addRelationships") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Add Relationships to a Service Instance",response=Response.class) - public Response addRelationships(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) { - msoLogger.debug ("version is: " + version); - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - return configurationRecipeLookup(request, Action.addRelationships, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][6]}/{serviceInstanceId}/removeRelationships") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Remove Relationships from Service Instance",response=Response.class) - public Response removeRelationships(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) { - msoLogger.debug ("version is: " + version); - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - return configurationRecipeLookup(request, Action.removeRelationships, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Create VNF on a specified version and serviceInstance",response=Response.class) - public Response createVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) { - msoLogger.debug ("version is: " + version); - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - return serviceInstances(request, Action.createInstance, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][5-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/replace") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Replace provided VNF instance",response=Response.class) - public Response replaceVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - msoLogger.debug ("version is: " + version); - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - return serviceInstances(request, Action.replaceInstance, instanceIdMap, version); - } - - @PUT - @Path("/{version:[vV][5-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Update VNF on a specified version, serviceInstance and vnfInstance",response=Response.class) - public Response updateVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - return serviceInstances(request, Action.updateInstance, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/applyUpdatedConfig") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Apply updated configuration",response=Response.class) - public Response applyUpdatedConfig(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - return serviceInstances(request, Action.applyUpdatedConfig, instanceIdMap, version); - } - - - @DELETE - @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Delete provided VNF instance",response=Response.class) - public Response deleteVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - return serviceInstances(request, Action.deleteInstance, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Create VfModule on a specified version, serviceInstance and vnfInstance",response=Response.class) - public Response createVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - msoLogger.debug ("version is: " + version); - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - return serviceInstances(request, Action.createInstance, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][5-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/replace") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Create VfModule on a specified version, serviceInstance and vnfInstance",response=Response.class) - public Response replaceVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) { - msoLogger.debug ("version is: " + version); - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId); - return serviceInstances(request, Action.replaceInstance, instanceIdMap, version); - } - - @PUT - @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Update VfModule on a specified version, serviceInstance, vnfInstance and vfModule",response=Response.class) - public Response updateVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId); - return serviceInstances(request, Action.updateInstance, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/inPlaceSoftwareUpdate") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Perform VNF software update",response=Response.class) - public Response inPlaceSoftwareUpdate(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - return serviceInstances(request, Action.inPlaceSoftwareUpdate, instanceIdMap, version); - } - - @DELETE - @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Delete provided VfModule instance",response=Response.class) - public Response deleteVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId); - return serviceInstances(request, Action.deleteInstance, instanceIdMap, version); - } - - - @POST - @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Create VolumeGroup on a specified version, serviceInstance, vnfInstance",response=Response.class) - public Response createVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - return serviceInstances(request, Action.createInstance, instanceIdMap, version); - } - - @PUT - @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Update VolumeGroup on a specified version, serviceInstance, vnfInstance and volumeGroup",response=Response.class) - public Response updateVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId); - return serviceInstances(request, Action.updateInstance, instanceIdMap, version); - } - - @DELETE - @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Delete provided VolumeGroup instance",response=Response.class) - public Response deleteVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId); - return serviceInstances(request, Action.deleteInstance, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][4-6]}/{serviceInstanceId}/networks") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Create NetworkInstance on a specified version and serviceInstance ",response=Response.class) - public Response createNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - return serviceInstances(request, Action.createInstance, instanceIdMap, version); - } - - @PUT - @Path("/{version:[vV][4-6]}/{serviceInstanceId}/networks/{networkInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Update VolumeGroup on a specified version, serviceInstance, networkInstance",response=Response.class) - public Response updateNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("networkInstanceId") String networkInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("networkInstanceId", networkInstanceId); - return serviceInstances(request, Action.updateInstance, instanceIdMap, version); - } - - @DELETE - @Path("/{version:[vV][4-6]}/{serviceInstanceId}/networks/{networkInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Delete provided Network instance",response=Response.class) - public Response deleteNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("networkInstanceId") String networkInstanceId) { - HashMap instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("networkInstanceId", networkInstanceId); - return serviceInstances(request, Action.deleteInstance, instanceIdMap, version); - } - - private Response serviceInstances(String requestJSON, Action action, HashMap instanceIdMap, String version) { - - String requestId = UUIDChecker.generateUUID(msoLogger); - long startTime = System.currentTimeMillis (); - msoLogger.debug ("requestId is: " + requestId); - ServiceInstancesRequest sir = null; - - MsoRequest msoRequest = new MsoRequest (requestId); - - try { - sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, msoRequest); - } catch(Exception e) { - msoLogger.debug("Exception occurred while mapping of request to JSON object ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Mapping of request to JSON object failed. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - try { - parseRequest(requestJSON, action, instanceIdMap, version, startTime, sir, msoRequest); - } catch(Exception e) { - msoLogger.debug("Exception occurred while logging ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Error parsing request. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Logging failed message to the database"); - msoRequest.createRequestRecord (Status.FAILED, action); - } - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName(); - String requestScope; - if(action == Action.inPlaceSoftwareUpdate || action == Action.applyUpdatedConfig){ - requestScope = (ModelType.vnf.name()); - }else{ - requestScope = sir.getRequestDetails().getModelInfo().getModelType().name(); - } - InfraActiveRequests dup = null; - - try { - dup = duplicateCheck(action, instanceIdMap, startTime, msoRequest, instanceName,requestScope); - } catch(Exception e) { - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, - e.getMessage(), - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null) ; - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - if (dup != null) { - return buildErrorOnDuplicateRecord(action, instanceIdMap, startTime, msoRequest, instanceName, requestScope, dup); - } - - ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse(); - - RequestReferences referencesResponse = new RequestReferences(); - - referencesResponse.setRequestId(requestId); - - serviceResponse.setRequestReferences(referencesResponse); - - CatalogDatabase db = null; - try { - db = CatalogDatabase.getInstance(); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "No communication to catalog DB " + e.getMessage (), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB)); - msoRequest.createRequestRecord (Status.FAILED,action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - RecipeLookupResult recipeLookupResult = null; - try { - recipeLookupResult = getServiceInstanceOrchestrationURI (db, msoRequest, action); - } catch (ValidationException e) { - msoLogger.debug ("Validation failed: ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Error validating request. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Logging failed message to the database"); - msoRequest.createRequestRecord (Status.FAILED, action); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception while querying Catalog DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "Recipe could not be retrieved from catalog DB " + e.getMessage (), - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.ERROR_FROM_CATALOG_DB)); - msoRequest.createRequestRecord (Status.FAILED,action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while querying Catalog DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - db.close(); - return response; - } - - if (recipeLookupResult == null) { - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No recipe found in DB"); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "Recipe does not exist in catalog DB", - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, - null); - msoRequest.createRequestRecord (Status.FAILED, action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - db.close(); - return response; - } - - - Boolean isBaseVfModule = false; - - if (msoRequest.getModelInfo() != null && (action == Action.applyUpdatedConfig || - action == Action.inPlaceSoftwareUpdate)) { - - } - ModelType modelType; - if (action == Action.applyUpdatedConfig || action == Action.inPlaceSoftwareUpdate) { - modelType = ModelType.vnf; - } - else { - modelType = msoRequest.getModelInfo().getModelType(); - } - - if (modelType.equals(ModelType.vfModule)) { - String asdcServiceModelVersion = msoRequest.getAsdcServiceModelVersion (); - - // Get VF Module-specific base module indicator - VfModule vfm; - - String modelVersionId = msoRequest.getModelInfo().getModelVersionId(); - - if(modelVersionId != null) { - vfm = db.getVfModuleByModelUuid(modelVersionId); - } else { - vfm = db.getVfModuleByModelInvariantUuidAndModelVersion(msoRequest.getModelInfo().getModelInvariantId(), msoRequest.getModelInfo().getModelVersion()); - } - - if (vfm != null) { - if (vfm.getIsBase() == 1) { - isBaseVfModule = true; - } - } - else if (action == Action.createInstance || action == Action.updateInstance){ - // There is no entry for this vfModuleType with this version, if specified, in VF_MODULE table in Catalog DB. - // This request cannot proceed - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "VF Module Type", "", MsoLogger.ErrorCode.DataError, "No VfModuleType found in DB"); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - String serviceVersionText = ""; - if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) { - serviceVersionText = " with version " + asdcServiceModelVersion; - } - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "VnfType " + msoRequest.getVnfType () + " and VF Module Model Name " + msoRequest.getVfModuleModelName() + serviceVersionText + " not found in MSO Catalog DB", - ErrorNumbers.SVC_BAD_PARAMETER, - null); - msoRequest.createRequestRecord (Status.FAILED, action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No matching vfModuleType found in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - db.close(); - return response; - } - } - - db.close(); - msoLogger.debug ("requestId is: " + msoRequest.getRequestId()); - msoLogger.debug ("About to insert a record"); - - try { - createRequestRecord(action, startTime, msoRequest); - } catch(Exception e) { - msoLogger.debug("Exception occurred while creating record in DB", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, - MsoException.ServiceException, - "Exception while creating record in DB " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, - null); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - return postBPELRequest(action, startTime, msoRequest, recipeLookupResult.getOrchestrationURI(), - recipeLookupResult.getRecipeTimeout(), isBaseVfModule); - } - - private RequestClientParamater buildRequestClientParameter(MsoRequest msoRequest, boolean isBaseVfModule, - int timeOut, String requestAction) throws IOException { - return new RequestClientParamater.Builder(). - setRequestId(msoRequest.getRequestId()). - setBaseVfModule(isBaseVfModule).setRecipeTimeout(timeOut). - setRequestAction(requestAction). - setServiceInstanceId(msoRequest.getServiceInstancesRequest().getServiceInstanceId()). - setCorrelationId(msoRequest.getServiceInstancesRequest().getCorrelationId()). - setVnfId(msoRequest.getServiceInstancesRequest().getVnfInstanceId()). - setVfModuleId(msoRequest.getServiceInstancesRequest().getVfModuleInstanceId()). - setVolumeGroupId(msoRequest.getServiceInstancesRequest().getVolumeGroupInstanceId()). - setNetworkId(msoRequest.getServiceInstancesRequest().getNetworkInstanceId()). - setConfigurationId(msoRequest.getServiceInstancesRequest().getConfigurationId()). - setServiceType(msoRequest.getServiceInstanceType()). - setVnfType(msoRequest.getVnfType()). - setVfModuleType(msoRequest.getVfModuleType()). - setNetworkType(msoRequest.getNetworkType()). - setRequestDetails(msoRequest.getRequestJSON()).build(); - } - - private Response postBPELRequest(Action action, long startTime, MsoRequest msoRequest, - String orchestrationUri, int timeOut, Boolean isBaseVfModule) { - RequestClient requestClient = null; - HttpResponse response = null; - long subStartTime = System.currentTimeMillis(); - try { - requestClient = RequestClientFactory.getRequestClient (orchestrationUri, MsoPropertiesUtils.loadMsoProperties ()); - msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ()); - - System.out.println("URL : " + requestClient.getUrl ()); - - response = requestClient.post(buildRequestClientParameter(msoRequest, isBaseVfModule, timeOut, action.name())); - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationUri, null); - } catch (Exception e) { - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationUri, null); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, - "Failed calling bpmn " + e.getMessage (), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - alarmLogger.sendAlarm ("MsoConfigurationError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity (),e); - return resp; - } - - if (response == null) { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, - "bpelResponse is null", - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ()); - int bpelStatus = respHandler.getStatus (); - - // BPEL accepted the request, the request is in progress - if (bpelStatus == HttpStatus.SC_ACCEPTED) { - String camundaJSONResponseBody = respHandler.getContent(); - msoLogger.debug ("Received from Camunda: " + camundaJSONResponseBody); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS); - (RequestsDatabase.getInstance()).updateInfraStatus (msoRequest.getRequestId (), - Status.IN_PROGRESS.toString (), - Constants.PROGRESS_REQUEST_IN_PROGRESS, - Constants.MODIFIED_BY_APIHANDLER); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN accepted the request, the request is in progress"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) camundaJSONResponseBody); - return Response.status (HttpStatus.SC_ACCEPTED).entity (camundaJSONResponseBody).build (); - } else { - List variables = new ArrayList<>(); - variables.add(bpelStatus + ""); - String camundaJSONResponseBody = respHandler.getContent(); - if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, - MsoException.ServiceException, - "Request Failed due to BPEL error with HTTP Status= %1 " + '\n' + camundaJSONResponseBody, - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - variables); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is failed with HTTP Status=" + bpelStatus); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } else { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, - MsoException.ServiceException, - "Request Failed due to BPEL error with HTTP Status= %1" , - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - variables); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - } - } - - private void createRequestRecord(Action action, long startTime, MsoRequest msoRequest) throws Exception { - try { - msoRequest.createRequestRecord (Status.PENDING, action); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.SchemaError, "Exception while creating record in DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while creating record in DB"); - throw new Exception(e); - } - } - - private Response buildErrorOnDuplicateRecord(Action action, HashMap instanceIdMap, long startTime, MsoRequest msoRequest, - String instanceName, String requestScope, InfraActiveRequests dup) { - - // Found the duplicate record. Return the appropriate error. - String instance = null; - if(instanceName != null){ - instance = instanceName; - }else{ - instance = instanceIdMap.get(requestScope + "InstanceId"); - } - String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") " + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - " + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding."; - //List variables = new ArrayList(); - //variables.add(dup.getRequestStatus()); - - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException, - dupMessage, - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null) ; - - - msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError, "Duplicate request - Subscriber already has a request for this service"); - msoRequest.createRequestRecord (Status.FAILED, action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - private InfraActiveRequests duplicateCheck(Action action, HashMap instanceIdMap, long startTime, - MsoRequest msoRequest, String instanceName, String requestScope) throws Exception { - InfraActiveRequests dup = null; - try { - if(!(instanceName==null && requestScope.equals("service") && (action == Action.createInstance || action == Action.activateInstance))){ - dup = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope); - } - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Error during duplicate check"); - throw new Exception(e); - } - return dup; - } - - private void parseRequest(String originalRequestJSON, Action action, HashMap instanceIdMap, String version, - long startTime, ServiceInstancesRequest sir, MsoRequest msoRequest) throws Exception { - try{ - msoRequest.parse(sir, instanceIdMap, action, version, originalRequestJSON); - } catch (Exception e) { - msoLogger.debug ("Validation failed: ", e); - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, originalRequestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - throw new Exception(e); - } - } - - private ServiceInstancesRequest convertJsonToServiceInstanceRequest(String requestJSON, Action action, long startTime, - MsoRequest msoRequest) throws Exception { - try{ - ObjectMapper mapper = new ObjectMapper(); - return mapper.readValue(requestJSON, ServiceInstancesRequest.class); - } catch(Exception e){ - msoLogger.debug ("Mapping of request to JSON object failed : ", e); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Mapping of request to JSON object failed"); - msoRequest.createRequestRecord (Status.FAILED, action); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); - throw new Exception(e); - } - } - - private RecipeLookupResult getServiceInstanceOrchestrationURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { - RecipeLookupResult recipeLookupResult = null; - //if the aLaCarte flag is set to TRUE, the API-H should choose the “VID_DEFAULT” recipe for the requested action - - msoLogger.debug("aLaCarteFlag is " + msoRequest.getALaCarteFlag()); - // Query MSO Catalog DB - - if (action == Action.applyUpdatedConfig || action == Action.inPlaceSoftwareUpdate) { - recipeLookupResult = getDefaultVnfUri(db, msoRequest, action); - } - else if (msoRequest.getModelInfo().getModelType().equals(ModelType.service)) { - recipeLookupResult = getServiceURI(db, msoRequest, action); - } - else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule) || - msoRequest.getModelInfo().getModelType().equals(ModelType.volumeGroup) || msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) { - - recipeLookupResult = getVnfOrVfModuleUri(db, msoRequest, action); - - }else if (msoRequest.getModelInfo().getModelType().equals(ModelType.network)) { - - recipeLookupResult = getNetworkUri(db, msoRequest, action); - } - - if (recipeLookupResult != null) { - msoLogger.debug ("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: " + Integer.toString(recipeLookupResult.getRecipeTimeout ())); - } - else { - msoLogger.debug("No matching recipe record found"); - } - return recipeLookupResult; - } - - - private RecipeLookupResult getServiceURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { - // SERVICE REQUEST - // Construct the default service name - // TODO need to make this a configurable property - String defaultServiceModelName = "*"; - String defaultSourceServiceModelName = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; - - Service serviceRecord; - ModelInfo modelInfo = msoRequest.getModelInfo(); - if(msoRequest.getALaCarteFlag()){ - serviceRecord = db.getServiceByModelName(defaultSourceServiceModelName); - if (serviceRecord == null) { - serviceRecord = db.getServiceByModelName(defaultServiceModelName); - } - }else{ - serviceRecord = db.getServiceByModelUUID(modelInfo.getModelVersionId()); // ModelVersionId is not required in v3 - if(serviceRecord == null) { - serviceRecord = db.getServiceByVersionAndInvariantId(modelInfo.getModelInvariantId(), modelInfo.getModelVersion()); - } - } - - ServiceRecipe recipe = null; - if(serviceRecord !=null){ - recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name()); - } - //if an aLaCarte flag was sent in the request, throw an error if the recipe was not found - RequestParameters reqParam = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters(); - if(reqParam!=null && reqParam.isaLaCarte()!=null && reqParam.isaLaCarte() && recipe==null){ - return null; - } else if (recipe==null) { - //aLaCarte wasn't sent, so we'll try the default - serviceRecord = db.getServiceByModelName(defaultSourceServiceModelName); - if (serviceRecord == null) { - serviceRecord = db.getServiceByModelName(defaultServiceModelName); - } - recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name()); - } - - if(modelInfo.getModelVersionId() == null) { - modelInfo.setModelVersionId(serviceRecord.getModelUUID()); - } - if(recipe==null){ - return null; - } - return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); - } - - - private RecipeLookupResult getVnfOrVfModuleUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { - - ModelInfo modelInfo = msoRequest.getModelInfo(); - String vnfComponentType = modelInfo.getModelType().name(); - - RelatedInstanceList[] instanceList = null; - if (msoRequest.getServiceInstancesRequest().getRequestDetails() != null) { - instanceList = msoRequest.getServiceInstancesRequest().getRequestDetails().getRelatedInstanceList(); - } - - Recipe recipe = null; - String defaultSource = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; - String modelCustomizationId = modelInfo.getModelCustomizationId(); - String modelCustomizationName = modelInfo.getModelCustomizationName(); - String relatedInstanceModelVersionId = null; - String relatedInstanceModelInvariantId = null; - String relatedInstanceVersion = null; - String relatedInstanceModelCustomizationName = null; - - if (instanceList != null) { - - for(RelatedInstanceList relatedInstanceList : instanceList){ - - RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); - ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo(); - if(relatedInstanceModelInfo.getModelType().equals(ModelType.service)){ - relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId(); - relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion(); - } - - if(relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)){ - relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId(); - relatedInstanceModelInvariantId = relatedInstanceModelInfo.getModelInvariantId(); - relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion(); - relatedInstanceModelCustomizationName = relatedInstanceModelInfo.getModelCustomizationName(); - } - } - - if(modelInfo.getModelType().equals(ModelType.vnf)) { - // a. For a vnf request (only create, no update currently): - // i. (v3-v4) If modelInfo.modelCustomizationId is provided, use it to validate catalog DB has record in vnf_resource_customization.model_customization_uuid. - // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or pre-v3), then modelInfo.modelCustomizationName must have - // been provided (else create request should be rejected). APIH should use the relatedInstance.modelInfo[service].modelVersionId** + modelInfo[vnf].modelCustomizationName - // to “join” service_to_resource_customizations with vnf_resource_customization to confirm a vnf_resource_customization.model_customization_uuid record exists. - // **If relatedInstance.modelInfo[service].modelVersionId was not provided, use relatedInstance.modelInfo[service].modelInvariantId + modelVersion instead to lookup modelVersionId - // (MODEL_UUID) in SERVICE table. - // iii. Regardless of how the value was provided/obtained above, APIH must always populate vnfModelCustomizationId in bpmnRequest. It would be assumed it was MSO generated - // during 1707 data migration if VID did not provide it originally on request. - // iv. Note: continue to construct the “vnf-type” value and pass to BPMN (must still be populated in A&AI). - // 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use modelCustomizationId to look it up in our catalog to construct vnf-type value to pass to BPMN. - - VnfResource vnfResource = null; - VnfResourceCustomization vrc; - // Validation for vnfResource - - if(modelCustomizationId!=null) { - vnfResource = db.getVnfResourceByModelCustomizationId(modelCustomizationId); - } else { - Service service = db.getServiceByModelUUID(relatedInstanceModelVersionId); - if(service == null) { - service = db.getServiceByVersionAndInvariantId(relatedInstanceModelInvariantId, relatedInstanceVersion); - } - - if(service == null) { - throw new ValidationException("service in relatedInstance"); - } - - vrc = db.getVnfResourceCustomizationByModelCustomizationName(modelCustomizationName, service.getModelUUID()); - if(vrc != null) { - vnfResource = vrc.getVnfResource(); - modelInfo.setModelCustomizationId(vrc.getModelCustomizationUuid()); - modelInfo.setModelCustomizationUuid(vrc.getModelCustomizationUuid()); - } - } - - if(vnfResource==null){ - throw new ValidationException("catalog entry"); - } else { - if(modelInfo.getModelVersionId() == null) { - modelInfo.setModelVersionId(vnfResource.getModelUuid()); - } - } - - VnfRecipe vnfRecipe = db.getVnfRecipe(defaultSource, action.name()); - - if (vnfRecipe == null) { - return null; - } - - return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout()); - } else { - // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or pre-v3), then modelInfo.modelCustomizationName must have - // been provided (else create request should be rejected). APIH should use the relatedInstance.modelInfo[vnf].modelVersionId** + modelInfo[vnf].modelCustomizationName - // to “join” vnf_to_resource_customizations with vf_resource_customization to confirm a vf_resource_customization.model_customization_uuid record exists. - // **If relatedInstance.modelInfo[vnf].modelVersionId was not provided, use relatedInstance.modelInfo[vnf].modelInvariantId + modelVersion instead - // to lookup modelVersionId (MODEL_UUID) in vnf_resource table. Once the vnf’s model_customization_uuid has been obtained, use it to find all vfModule customizations - // for that vnf customization in the vnf_res_custom_to_vf_module_custom join table. For each vf_module_cust_model_customization_uuid value returned, - // use that UUID to query vf_module_customization table along with modelInfo[vfModule|volumeGroup].modelVersionId** to confirm record matches request data - // (and to identify the modelCustomizationId associated with the vfModule in the request). **If modelInfo[vfModule|volumeGroup].modelVersionId was not - // provided (potentially in v2/v3), use modelInfo[vfModule|volumeGroup].modelInvariantId + modelVersion instead. This means taking each record found - // in vf_module_customization and looking up in vf_module (using vf_module_customization’s FK into vf_module) to find a match on MODEL_INVARIANT_UUID (modelInvariantId) - // and MODEL_VERSION (modelVersion). - - VfModuleCustomization vfmc = null; - VnfResourceCustomization vnfrc; - VfModule vfModule = null; - - if( modelInfo.getModelCustomizationId() != null) { - vfmc = db.getVfModuleCustomizationByModelCustomizationId(modelInfo.getModelCustomizationId()); - } else { - vnfrc =db.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId(relatedInstanceModelCustomizationName, relatedInstanceModelVersionId); - if(vnfrc == null) { - vnfrc = db.getVnfResourceCustomizationByModelInvariantId(relatedInstanceModelInvariantId, relatedInstanceVersion, relatedInstanceModelCustomizationName); - } - - List list = db.getVfModuleCustomizationByVnfModuleCustomizationUuid(vnfrc.getModelCustomizationUuid()); - - String vfModuleModelUUID = modelInfo.getModelVersionId(); - for(VfModuleCustomization vf : list) { - if(vfModuleModelUUID != null) { - vfModule = db.getVfModuleByModelCustomizationIdAndVersion(vf.getModelCustomizationUuid(), vfModuleModelUUID); - } else { - vfModule = db.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId(vf.getModelCustomizationUuid(), modelInfo.getModelVersion(), modelInfo.getModelInvariantId()); - } - - if(vfModule != null) { - modelInfo.setModelCustomizationId(vf.getModelCustomizationUuid()); - modelInfo.setModelCustomizationUuid(vf.getModelCustomizationUuid()); - break; - } - } - } - - if(vfmc == null && vfModule == null) { - throw new ValidationException("no catalog entry found"); - } else if (vfModule == null && vfmc != null) { - vfModule = vfmc.getVfModule(); // can't be null as vfModuleModelUUID is not-null property in VfModuleCustomization table - } - - if(modelInfo.getModelVersionId() == null) { - modelInfo.setModelVersionId(vfModule.getModelUUID()); - } - recipe = db.getVnfComponentsRecipeByVfModuleModelUUId(vfModule.getModelUUID(), vnfComponentType, action.name()); - - if(recipe == null) { - recipe = db.getVnfComponentsRecipeByVfModuleModelUUId(defaultSource, vnfComponentType, action.name()); - if (recipe == null) { - recipe = db.getVnfComponentsRecipeByVfModuleModelUUId("*", vnfComponentType, action.name()); - } - - if(recipe == null) { - return null; - } - } - } - } else { - msoLogger.debug("recipe is null, getting default"); - - if(modelInfo.getModelType().equals(ModelType.vnf)) { - recipe = db.getVnfRecipe(defaultSource, action.name()); - if (recipe == null) { - return null; - } - } else { - recipe = db.getVnfComponentsRecipeByVfModuleModelUUId(defaultSource, vnfComponentType, action.name()); - - if (recipe == null) { - return null; - } - } - } - - return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); - } - - private RecipeLookupResult getDefaultVnfUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { - - String defaultSource = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; - - VnfRecipe vnfRecipe = db.getVnfRecipe(defaultSource, action.name()); - - if (vnfRecipe == null) { - return null; - } - - return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout()); - } - - private RecipeLookupResult getNetworkUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { - - String defaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; - - ModelInfo modelInfo = msoRequest.getModelInfo(); - String modelName = modelInfo.getModelName(); - Recipe recipe = null; - - if(modelInfo.getModelCustomizationId()!=null){ - NetworkResource networkResource = db.getNetworkResourceByModelCustUuid(modelInfo.getModelCustomizationId()); - if(networkResource!=null){ - if(modelInfo.getModelVersionId() == null) { - modelInfo.setModelVersionId(networkResource.getModelUUID()); - } - recipe = db.getNetworkRecipe(networkResource.getModelName(), action.name()); - }else{ - throw new ValidationException("no catalog entry found"); - } - }else{ - //ok for version < 3 and action delete - recipe = db.getNetworkRecipe(modelName, action.name()); - } - - if(recipe == null){ - recipe = db.getNetworkRecipe(defaultNetworkType, action.name()); - } - - return recipe !=null ? new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout()) : null; - } - - private Response configurationRecipeLookup(String requestJSON, Action action, HashMap instanceIdMap, String version) { - String requestId = UUIDChecker.generateUUID(msoLogger); - long startTime = System.currentTimeMillis (); - msoLogger.debug ("requestId is: " + requestId); - ServiceInstancesRequest sir = null; - MsoRequest msoRequest = new MsoRequest (requestId); - - try { - sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, msoRequest); - } catch(Exception e) { - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Mapping of request to JSON object failed. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - try { - parseRequest(requestJSON, action, instanceIdMap, version, startTime, sir, msoRequest); - } catch(Exception e) { - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Error parsing request. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName(); - String requestScope; - if(action == Action.inPlaceSoftwareUpdate || action == Action.applyUpdatedConfig){ - requestScope = (ModelType.vnf.name()); - }else{ - requestScope = sir.getRequestDetails().getModelInfo().getModelType().name(); - } - InfraActiveRequests dup = null; - - try { - dup = duplicateCheck(action, instanceIdMap, startTime, msoRequest, instanceName,requestScope); - } catch(Exception e) { - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, - e.getMessage(), - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null) ; - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - if (dup != null) { - return buildErrorOnDuplicateRecord(action, instanceIdMap, startTime, msoRequest, instanceName, requestScope, dup); - } - - ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse(); - RequestReferences referencesResponse = new RequestReferences(); - referencesResponse.setRequestId(requestId); - serviceResponse.setRequestReferences(referencesResponse); - - MsoJavaProperties props = MsoPropertiesUtils.loadMsoProperties (); - String orchestrationUri = props.getProperty(CommonConstants.ALACARTE_ORCHESTRATION, null); - String timeOut = props.getProperty(CommonConstants.ALACARTE_RECIPE_TIMEOUT, null); - - if (StringUtils.isBlank(orchestrationUri) || StringUtils.isBlank(timeOut)) { - String error = StringUtils.isBlank(orchestrationUri) ? "ALaCarte Orchestration URI not found in properties" : "ALaCarte Recipe Timeout not found in properties"; - - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.DataError, error); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - error, - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, - null); - msoRequest.createRequestRecord (Status.FAILED, action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - - } - - requestId = msoRequest.getRequestId (); - msoLogger.debug ("requestId is: " + requestId); - msoLogger.debug ("About to insert a record"); - - try { - createRequestRecord(action, startTime, msoRequest); - } catch(Exception e) { - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR, - MsoException.ServiceException, - "Exception while creating record in DB " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, - null); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - return postBPELRequest(action, startTime, msoRequest, orchestrationUri, Integer.parseInt(timeOut), false); - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java deleted file mode 100644 index b2b90f76b0..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra; - -/* - * Enum for Status values returned by API Handler to Tail-F -*/ -public enum Status { - PENDING, - IN_PROGRESS, - COMPLETE, - FAILED, - TIMEOUT, - UNLOCKED, - PENDING_MANUAL_TASK -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java deleted file mode 100644 index 9aac16aa4c..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java +++ /dev/null @@ -1,327 +0,0 @@ -/*- - * #%L - * MSO - * %% - * Copyright (C) 2016 ONAP - SO - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -package org.openecomp.mso.apihandlerinfra; - -import org.openecomp.mso.apihandlerinfra.tasksbeans.*; - -import java.text.ParseException; -import java.util.ArrayList; -import java.util.List; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Response; - -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.json.JSONArray; -import org.json.JSONObject; -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.openecomp.mso.apihandler.common.ErrorNumbers; -import org.openecomp.mso.apihandler.common.RequestClient; -import org.openecomp.mso.apihandler.common.RequestClientFactory; -import org.openecomp.mso.apihandler.common.ResponseHandler; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.utils.UUIDChecker; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; - -@Path("/tasks") -@Api(value="/tasks/{version: [vV]1}",description="Queries of Manual Tasks") -public class TasksHandler { - - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - public final static String requestUrl = "mso/task/"; - - @Path("/{version:[vV]1}") - @GET - @ApiOperation(value="Finds Manual Tasks",response=Response.class) - public Response queryFilters (@QueryParam("taskId") String taskId, - @QueryParam("originalRequestId") String originalRequestId, - @QueryParam("subscriptionServiceType") String subscriptionServiceType, - @QueryParam("nfRole") String nfRole, - @QueryParam("buildingBlockName") String buildingBlockName, - @QueryParam("originalRequestDate") String originalRequestDate, - @QueryParam("originalRequestorId") String originalRequestorId, - @PathParam("version") String version) throws ParseException { - Response responseBack = null; - long startTime = System.currentTimeMillis (); - String requestId = UUIDChecker.generateUUID(msoLogger); - MsoLogger.setServiceName ("ManualTasksQuery"); - // Generate a Request Id - UUIDChecker.generateUUID(msoLogger); - msoLogger.debug ("Incoming request received for queryFilter with taskId:" + taskId - + " originalRequestId:" + originalRequestId - + " subscriptionServiceType:" + subscriptionServiceType - + " nfRole:" + nfRole - + " buildingBlockName:" + buildingBlockName - + " originalRequestDate:" + originalRequestDate - + " originalRequestorId: " + originalRequestorId); - - // Prepare the query string to /task interface - TaskVariables tv = new TaskVariables(); - - List tvvList = new ArrayList<>(); - - if (originalRequestId != null) { - TaskVariableValue tvv = new TaskVariableValue(); - tvv.setName("originalRequestId"); - tvv.setValue(originalRequestId); - tvv.setOperator("eq"); - tvvList.add(tvv); - } - if (subscriptionServiceType != null) { - TaskVariableValue tvv = new TaskVariableValue(); - tvv.setName("subscriptionServiceType"); - tvv.setValue(subscriptionServiceType); - tvv.setOperator("eq"); - tvvList.add(tvv); - } - if (nfRole != null) { - TaskVariableValue tvv = new TaskVariableValue(); - tvv.setName("nfRole"); - tvv.setValue(nfRole); - tvv.setOperator("eq"); - tvvList.add(tvv); - } - if (buildingBlockName != null) { - TaskVariableValue tvv = new TaskVariableValue(); - tvv.setName("buildingBlockName"); - tvv.setValue(buildingBlockName); - tvv.setOperator("eq"); - tvvList.add(tvv); - } - if (originalRequestDate != null) { - TaskVariableValue tvv = new TaskVariableValue(); - tvv.setName("originalRequestDate"); - tvv.setValue(originalRequestDate); - tvv.setOperator("eq"); - tvvList.add(tvv); - } - if (originalRequestorId != null) { - TaskVariableValue tvv = new TaskVariableValue(); - tvv.setName("originalRequestorId"); - tvv.setValue(originalRequestorId); - tvv.setOperator("eq"); - tvvList.add(tvv); - } - - tv.setTaskVariables(tvvList); - - RequestClient requestClient = null; - MsoRequest msoRequest = new MsoRequest(requestId); - HttpResponse response = null; - long subStartTime = System.currentTimeMillis(); - - try { - requestClient = RequestClientFactory.getRequestClient (requestUrl, MsoPropertiesUtils.loadMsoProperties ()); - // Capture audit event - msoLogger.debug ("MSO API Handler Post call to Camunda engine for url: " + requestClient.getUrl ()); - - System.out.println("URL : " + requestClient.getUrl ()); - ObjectMapper mapper = new ObjectMapper(); - String camundaJsonReq = mapper.writeValueAsString(tv); - msoLogger.debug("Camunda Json Request: " + camundaJsonReq); - response = requestClient.post(camundaJsonReq); - - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", requestUrl, null); - } catch (Exception e) { - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", requestUrl, null); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, - "Failed calling bpmn " + e.getMessage (), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - alarmLogger.sendAlarm ("MsoConfigurationError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity (),e); - return resp; - } - TasksGetResponse trr = new TasksGetResponse(); - List taskList = new ArrayList<>(); - - ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ()); - int bpelStatus = respHandler.getStatus (); - if (bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) { - msoLogger.debug ("Received good response from Camunda"); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request"); - String respBody = respHandler.getContent(); - if (respBody != null) { - JSONArray data = new JSONArray(respBody); - - for (int i=0; i locationConstraints; - - @JsonProperty("resources") - private List resources; - - @JsonProperty("requestInputs") - private HashMap requestInputs; - - @JsonIgnore - private Map additionalProperties = new HashMap<>(); - - public Map getAdditionalProperties() { - return additionalProperties; - } - - public void setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - /** - * @return Returns the resources. - */ - public List getResources() { - return resources; - } - - /** - * @param resources The resources to set. - */ - public void setResources(List resources) { - this.resources = resources; - } - - public List getLocationConstraints() { - return locationConstraints; - } - - public void setLocationConstraints(List locationConstraints) { - this.locationConstraints = locationConstraints; - } - - public HashMap getRequestInputs() { - return requestInputs; - } - - public void setRequestInputs(HashMap requestInputs) { - this.requestInputs = requestInputs; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java deleted file mode 100644 index 5b48cbecbc..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java +++ /dev/null @@ -1,113 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - -import java.sql.Timestamp; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT) -public class E2ERequest { - - protected String operationId; - protected String operation; - protected String result; - protected String reason; - protected String userId; - protected String operationContent; - protected long progress; - protected String operateAt; - protected String finishedAt; - - public String getOperationId() { - return operationId; - } - - public void setOperationId(String operationId) { - this.operationId = operationId; - } - - public String getOperation() { - return operation; - } - - public void setOperation(String operation) { - this.operation = operation; - } - - public String getResult() { - return result; - } - - public void setResult(String result) { - this.result = result; - } - - public String getReason() { - return reason; - } - - public void setReason(String reason) { - this.reason = reason; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getOperationContent() { - return operationContent; - } - - public void setOperationContent(String operationContent) { - this.operationContent = operationContent; - } - - public long getProgress() { - return progress; - } - - public void setProgress(long progress) { - this.progress = progress; - } - - public String getOperateAt() { - return operateAt; - } - - public void setOperateAt(String operateAt) { - this.operateAt = operateAt; - } - - public String getFinishedAt() { - return finishedAt; - } - - public void setFinishedAt(String finishedAt) { - this.finishedAt = finishedAt; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EService.java deleted file mode 100644 index 4466a284fe..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EService.java +++ /dev/null @@ -1,120 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; - -import java.util.HashMap; -import java.util.Map; - -@JsonIgnoreProperties({ "additionalProperties" }) -public class E2EService { - - @JsonProperty("name") - private String name; - - @JsonProperty("description") - private String description; - - @JsonProperty("serviceInvariantUuid") - private String serviceInvariantUuid; - - @JsonProperty("serviceUuid") - private String serviceUuid; - - @JsonProperty("globalSubscriberId") - private String globalSubscriberId; - - @JsonProperty("serviceType") - private String serviceType; - - @JsonProperty("parameters") - private E2EParameters parameters; - - @JsonIgnore - private Map additionalProperties = new HashMap<>(); - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public E2EParameters getParameters() { - return parameters; - } - - public void setParameters(E2EParameters parameters) { - this.parameters = parameters; - } - - public Map getAdditionalProperties() { - return additionalProperties; - } - - public void setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - public String getServiceInvariantUuid() { - return serviceInvariantUuid; - } - - public void setServiceInvariantUuid(String serviceInvariantUuid) { - this.serviceInvariantUuid = serviceInvariantUuid; - } - - public String getGlobalSubscriberId() { - return globalSubscriberId; - } - - public void setGlobalSubscriberId(String globalSubscriberId) { - this.globalSubscriberId = globalSubscriberId; - } - - public String getServiceType() { - return serviceType; - } - - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - - public String getServiceUuid() { - return serviceUuid; - } - - public void setServiceUuid(String serviceUuid) { - this.serviceUuid = serviceUuid; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java deleted file mode 100644 index 157ee72535..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - - -public class E2EServiceInstanceDeleteRequest { - - private String globalSubscriberId; - - private String serviceType; - - public String getGlobalSubscriberId() { - return globalSubscriberId; - } - - public void setGlobalSubscriberId(String globalSubscriberId) { - this.globalSubscriberId = globalSubscriberId; - } - - public String getServiceType() { - return serviceType; - } - - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java deleted file mode 100644 index 01ea4a9c7d..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - -import java.util.HashMap; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; - -@JsonIgnoreProperties({ "additionalProperties" }) -public class E2EServiceInstanceRequest { - - @JsonProperty("service") - private E2EService service; - - @JsonIgnore - private Map additionalProperties = new HashMap<>(); - - public E2EService getService() { - return service; - } - - public void setService(E2EService service) { - this.service = service; - } - - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - - - public void setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java deleted file mode 100644 index b8bd810f4f..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - - -public class E2EServiceInstanceScaleRequest { - - private ScaleService service; - - public ScaleService getService() { - return service; - } - - public void setService(ScaleService service) { - this.service = service; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java deleted file mode 100644 index cc0582080f..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - -import java.util.HashMap; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; - -public class E2EUserParam { - - @JsonProperty("name") - private String name; - - @JsonProperty("value") - private String value; - - @JsonIgnore - private Map additionalProperties = new HashMap<>(); - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public void setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java deleted file mode 100644 index 18cdd993c6..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import org.openecomp.mso.requestsdb.OperationStatus; - -@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) -public class GetE2EServiceInstanceResponse { - - protected OperationStatus operation; - - public OperationStatus getOperationStatus() { - return operation; - } - - public void setOperationStatus(OperationStatus requestDB) { - this.operation = requestDB; - } - - public OperationStatus getOperation() { - return operation; - } - - public void setOperation(OperationStatus operation) { - this.operation = operation; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/LocationConstraint.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/LocationConstraint.java deleted file mode 100644 index 46ab896cb5..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/LocationConstraint.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - -import org.codehaus.jackson.annotate.JsonProperty; - -/** - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-9-6 - */ -public class LocationConstraint { - - /** - * vnf profile id - */ - @JsonProperty("vnfProfileId") - private String vnfProfileId; - - /** - * location constraints: vimId - */ - @JsonProperty("locationConstraints") - private VimLocation locationConstraints; - - /** - * @return Returns the vnfProfileId. - */ - public String getVnfProfileId() { - return vnfProfileId; - } - - /** - * @param vnfProfileId The vnfProfileId to set. - */ - public void setVnfProfileId(String vnfProfileId) { - this.vnfProfileId = vnfProfileId; - } - - - /** - * @return Returns the locationConstraints. - */ - public VimLocation getLocationConstraints() { - return locationConstraints; - } - - - /** - * @param locationConstraints The locationConstraints to set. - */ - public void setLocationConstraints(VimLocation locationConstraints) { - this.locationConstraints = locationConstraints; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java deleted file mode 100644 index 4343847b59..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-9-6 - */ -public class NsParameters { - - private List locationConstraints; - - private Map additionalParamForNs = new HashMap<>(); - /** - * @return Returns the locationConstraints. - */ - public List getLocationConstraints() { - return locationConstraints; - } - - /** - * @param locationConstraints The locationConstraints to set. - */ - public void setLocationConstraints(List locationConstraints) { - this.locationConstraints = locationConstraints; - } - - - /** - * @return Returns the additionalParamForNs. - */ - public Map getAdditionalParamForNs() { - return additionalParamForNs; - } - - - /** - * @param additionalParamForNs The additionalParamForNs to set. - */ - public void setAdditionalParamForNs(Map additionalParamForNs) { - this.additionalParamForNs = additionalParamForNs; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java deleted file mode 100644 index a77c88ed3c..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; - -import java.util.HashMap; -import java.util.Map; - -public class ResourceRequest { - - @JsonProperty("resourceName") - private String resourceName; - - @JsonProperty("resourceInvariantUuid") - private String resourceInvariantUuid; - - @JsonProperty("resourceUuid") - private String resourceUuid; - - @JsonProperty("resourceCustomizationUuid") - private String resourceCustomizationUuid; - - @JsonProperty("parameters") - private E2EParameters parameters; - - @JsonIgnore - private Map additionalProperties = new HashMap<>(); - - /** - * @return Returns the resourceName. - */ - public String getResourceName() { - return resourceName; - } - - /** - * @param resourceName The resourceName to set. - */ - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - public Map getAdditionalProperties() { - return additionalProperties; - } - - public void setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - public String getResourceInvariantUuid() { - return resourceInvariantUuid; - } - - public void setResourceInvariantUuid(String resourceInvariantUuid) { - this.resourceInvariantUuid = resourceInvariantUuid; - } - - public String getResourceUuid() { - return resourceUuid; - } - - public void setResourceUuid(String resourceUuid) { - this.resourceUuid = resourceUuid; - } - - public String getResourceCustomizationUuid() { - return resourceCustomizationUuid; - } - - public void setResourceCustomizationUuid(String resourceCustomizationUuid) { - this.resourceCustomizationUuid = resourceCustomizationUuid; - } - - public E2EParameters getParameters() { - return parameters; - } - - public void setParameters(E2EParameters parameters) { - this.parameters = parameters; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java deleted file mode 100644 index c64f5fa207..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - -public class ScaleNsByStepsData { - - private String aspectId; - - private Integer numberOfSteps; - - private String scalingDirection; - - public String getAspectId() { - return aspectId; - } - - public void setAspectId(String aspectId) { - this.aspectId = aspectId; - } - - public Integer getNumberOfSteps() { - return numberOfSteps; - } - - public void setNumberOfSteps(Integer numberOfSteps) { - this.numberOfSteps = numberOfSteps; - } - - public String getScalingDirection() { - return scalingDirection; - } - - public void setScalingDirection(String scalingDirection) { - this.scalingDirection = scalingDirection; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java deleted file mode 100644 index 49cfe75a5b..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - -public class ScaleNsData { - - private ScaleNsByStepsData scaleNsByStepsData; - - public ScaleNsByStepsData getScaleNsByStepsData() { - return scaleNsByStepsData; - } - - public void setScaleNsByStepsData(ScaleNsByStepsData scaleNsByStepsData) { - this.scaleNsByStepsData = scaleNsByStepsData; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java deleted file mode 100644 index f19e2bdb80..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - -public class ScaleResource { - - private String resourceInstanceId; - - private String scaleType; - - private ScaleNsData scaleNsData; - - public String getResourceInstanceId() { - return resourceInstanceId; - } - - public void setResourceInstanceId(String resourceInstanceId) { - this.resourceInstanceId = resourceInstanceId; - } - - public String getScaleType() { - return scaleType; - } - - public void setScaleType(String scaleType) { - this.scaleType = scaleType; - } - - public ScaleNsData getScaleNsData() { - return scaleNsData; - } - - public void setScaleNsData(ScaleNsData scaleNsData) { - this.scaleNsData = scaleNsData; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java deleted file mode 100644 index c694f550f8..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - -import java.util.List; - -public class ScaleService { - - private String serviceInstanceName; - - private String serviceType; - - private String globalSubscriberId; - - private List resources; - - public String getServiceInstanceName() { - return serviceInstanceName; - } - - public void setServiceInstanceName(String serviceInstanceName) { - this.serviceInstanceName = serviceInstanceName; - } - - public String getServiceType() { - return serviceType; - } - - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - - public String getGlobalSubscriberId() { - return globalSubscriberId; - } - - public void setGlobalSubscriberId(String globalSubscriberId) { - this.globalSubscriberId = globalSubscriberId; - } - - public List getResources() { - return resources; - } - - public void setResources(List resources) { - this.resources = resources; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/VimLocation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/VimLocation.java deleted file mode 100644 index 55d6c8997a..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/VimLocation.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class VimLocation { - - @JsonProperty("vimId") - private String vimId; - - - /** - * @return Returns the vimId. - */ - public String getVimId() { - return vimId; - } - - - /** - * @param vimId The vimId to set. - */ - public void setVimId(String vimId) { - this.vimId = vimId; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java deleted file mode 100644 index 2fd36547d2..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.01.08 at 03:50:12 PM EST -// - -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/mso/request/types/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package org.openecomp.mso.apihandlerinfra; - diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java deleted file mode 100644 index 795b8f4b7a..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tasksbeans; - -import com.fasterxml.jackson.annotation.JsonRootName; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -@JsonRootName(value = "requestDetails") -@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) -public class RequestDetails { - - protected RequestInfo requestInfo; - /** - * Gets the value of the requestInfo property. - * - * @return - * possible object is - * {@link RequestInfo } - * - */ - public RequestInfo getRequestInfo() { - return requestInfo; - } - - /** - * Sets the value of the requestInfo property. - * - * @param value - * allowed object is - * {@link RequestInfo } - * - */ - public void setRequestInfo(RequestInfo value) { - this.requestInfo = value; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java deleted file mode 100644 index 1406c11590..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tasksbeans; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) -public class RequestInfo { - - protected String source; - protected ValidResponses responseValue; - protected String requestorId; - - /** - * Gets the value of the source property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSource() { - return source; - } - - /** - * Sets the value of the source property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSource(String value) { - this.source = value; - } - - public ValidResponses getResponseValue() { - return responseValue; - } - - public void setResponseValue(ValidResponses responseValue) { - this.responseValue = responseValue; - } - - - public String getRequestorId() { - return requestorId; - } - - public void setRequestorId(String requestorId) { - this.requestorId = requestorId; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java deleted file mode 100644 index d18070fbb7..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java +++ /dev/null @@ -1,333 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tasksbeans; - -import org.json.JSONArray; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) -public class TaskList { - protected String taskId; - protected String type; - protected String nfRole; - protected String subscriptionServiceType; - protected String originalRequestId; - protected String originalRequestorId; - protected String errorSource; - protected String errorCode; - protected String errorMessage; - protected String buildingBlockName; - protected String buildingBlockStep; - protected JSONArray validResponses; - - /** - * Gets the value of the taskId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTaskId() { - return taskId; - } - - /** - * Sets the value of the taskId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTaskId(String value) { - this.taskId = value; - } - - /** - * Gets the value of the type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getType() { - return type; - } - - /** - * Sets the value of the type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setType(String value) { - this.type = value; - } - - /** - * Gets the value of the nfRole property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getNfRole() { - return nfRole; - } - - /** - * Sets the value of the nfRole property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setNfRole(String value) { - this.nfRole = value; - } - - /** - * Gets the value of the subscriptionServiceType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSubscriptionServiceType() { - return subscriptionServiceType; - } - - /** - * Sets the value of the subscriptionServiceType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSubscriptionServiceType(String value) { - this.subscriptionServiceType = value; - } - - /** - * Gets the value of the originalRequestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOriginalRequestId() { - return originalRequestId; - } - - /** - * Sets the value of the originalRequestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOriginalRequestId(String value) { - this.originalRequestId = value; - } - - /** - * Gets the value of the originalRequestorId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOriginalRequestorId() { - return originalRequestorId; - } - - /** - * Sets the value of the originalRequestorId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOriginalRequestorId(String value) { - this.originalRequestorId = value; - } - - /** - * Gets the value of the errorSource property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getErrorSource() { - return errorSource; - } - - /** - * Sets the value of the errorSource property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setErrorSource(String value) { - this.errorSource = value; - } - - /** - * Gets the value of the errorCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getErrorCode() { - return errorCode; - } - - /** - * Sets the value of the errorCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setErrorCode(String value) { - this.errorCode = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - /** - * Gets the value of the buildingBlockName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getBuildingBlockName() { - return buildingBlockName; - } - - /** - * Sets the value of the buildingBlockName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setBuildingBlockName(String value) { - this.buildingBlockName = value; - } - - /** - * Gets the value of the buildingBlockStep property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getBuildingBlockStep() { - return buildingBlockStep; - } - - /** - * Sets the value of the buildingBlockStep property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setBuildingBlockStep(String value) { - this.buildingBlockStep = value; - } - - /** - * Gets the value of the validResponses property. - * - * @return - * possible object is - * {@link ValidResponses } - * - */ - public JSONArray getValidResponses() { - return validResponses; - } - - /** - * Sets the value of the validResponses property. - * - * @param value - * allowed object is - * {@link ValidResponses } - * - */ - public void setValidResponses(JSONArray value) { - this.validResponses = value; - } - - - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java deleted file mode 100644 index b081f3924f..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java +++ /dev/null @@ -1,56 +0,0 @@ -/* ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tasksbeans; - -import com.fasterxml.jackson.annotation.JsonRootName; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -@JsonRootName(value = "taskRequestReference") -@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) -public class TaskRequestReference { - - protected String taskId; - - /** - * Gets the value of the taskId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTaskId() { - return taskId; - } - - /** - * Sets the value of the taskId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTaskId(String value) { - this.taskId = value; - } - - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java deleted file mode 100644 index 2a0641a424..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java +++ /dev/null @@ -1,107 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tasksbeans; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) -public class TaskVariableValue { - - protected String name; - protected String value; - protected String operator; - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - /** - * Gets the value of the operator property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOperator() { - return operator; - } - - /** - * Sets the value of the operator property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOperator(String value) { - this.operator = value; - } - - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java deleted file mode 100644 index 943635ff0c..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tasksbeans; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -import java.util.List; - -@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) -public class TaskVariables { - - private List taskVariables; - - public List getTaskVariables() { - return taskVariables; - } - - public void setTaskVariables(List taskVariables) { - this.taskVariables = taskVariables; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponse.java deleted file mode 100644 index c21792acc1..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tasksbeans; - -import java.util.List; - -public class TasksGetResponse { - - private List taskList; - - public List getTaskList() { - return taskList; - } - - public void setTaskList(List taskList) { - this.taskList = taskList; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequest.java deleted file mode 100644 index 9f65aa07a5..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequest.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tasksbeans; - -public class TasksRequest { - - private RequestDetails requestDetails; - - public RequestDetails getRequestDetails() { - return requestDetails; - } - - public void setRequestDetails(RequestDetails requestDetails) { - this.requestDetails = requestDetails; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java deleted file mode 100644 index 9310cd4730..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - - -package org.openecomp.mso.apihandlerinfra.tasksbeans; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) - -public enum ValidResponses { - - rollback, - abort, - skip, - retry - ; - - public String value() { - return name(); - } - - public static ValidResponses fromValue(String v) { - return valueOf(v); - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java deleted file mode 100644 index f2fed8589b..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tasksbeans; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) -public class Value { - - protected String value; - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java deleted file mode 100644 index 9d3852cc07..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tasksbeans; - -import com.fasterxml.jackson.annotation.JsonRootName; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -@JsonRootName(value = "variables") -@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) -public class Variables { - - protected Value source; - protected Value responseValue; - protected Value requestorId; - - /** - * Gets the value of the source property. - * - * @return - * possible object is - * {@link String } - * - */ - public Value getSource() { - return source; - } - - /** - * Sets the value of the source property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSource(Value value) { - this.source = value; - } - - public Value getResponseValue() { - return responseValue; - } - - public void setResponseValue(Value responseValue) { - this.responseValue = responseValue; - } - - - public Value getRequestorId() { - return requestorId; - } - - public void setRequestorId(Value requestorId) { - this.requestorId = requestorId; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java deleted file mode 100644 index 92e74e8de2..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.openecomp.mso.apihandlerinfra.MsoPropertiesUtils; -import org.openecomp.mso.client.aai.AAIProperties; -import org.openecomp.mso.client.aai.AAIVersion; -import org.openecomp.mso.properties.MsoJavaProperties; - -public class AaiClientPropertiesImpl implements AAIProperties { - - final MsoJavaProperties props; - public AaiClientPropertiesImpl() { - this.props = MsoPropertiesUtils.loadMsoProperties (); - } - - @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(props.getProperty("aai.endpoint", null)); - } - - @Override - public String getSystemName() { - return "MSO"; - } - - @Override - public AAIVersion getDefaultVersion() { - return AAIVersion.LATEST; - } - - @Override - public String getAuth() { - return props.getProperty("aai.auth", null); - } - - @Override - public String getKey() { - return props.getProperty("mso.msoKey", null); - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java deleted file mode 100644 index ecbe97c637..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java +++ /dev/null @@ -1,334 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation; - - -import java.util.HashMap; - -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.apache.http.HttpStatus; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.mso.apihandler.common.ErrorNumbers; -import org.openecomp.mso.apihandlerinfra.Constants; -import org.openecomp.mso.apihandlerinfra.MsoException; -import org.openecomp.mso.apihandlerinfra.Status; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Action; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.OperationalEnvironment; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestReferences; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.TenantSyncResponse; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.InfraActiveRequests; -import org.openecomp.mso.requestsdb.RequestsDatabase; -import org.openecomp.mso.utils.UUIDChecker; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; - -@Path("/cloudResources") -@Api(value="/cloudResources",description="API Requests for cloud resources - Tenant Isolation") -public class CloudOrchestration { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - private TenantIsolationRunnable tenantIsolation = null; - private TenantIsolationRequest tenantIsolationRequest = null; - private RequestsDatabase requestsDatabase = null; - - @POST - @Path("/{version:[vV][1]}/operationalEnvironments") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Create an Operational Environment",response=Response.class) - public Response createOperationEnvironment(String request, @PathParam("version") String version) { - msoLogger.debug("Received request to Create Operational Environment"); - return cloudOrchestration(request, Action.create, null, version); - } - - @POST - @Path("/{version:[vV][1]}/operationalEnvironments/{operationalEnvironmentId}/activate") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Activate an Operational Environment",response=Response.class) - public Response activateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId) { - msoLogger.debug("Received request to Activate an Operational Environment"); - HashMap instanceIdMap = new HashMap(); - instanceIdMap.put("operationalEnvironmentId", operationalEnvironmentId); - return cloudOrchestration(request, Action.activate, instanceIdMap, version); - } - - @POST - @Path("/{version:[vV][1]}/operationalEnvironments/{operationalEnvironmentId}/deactivate") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Deactivate an Operational Environment",response=Response.class) - public Response deactivateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId) { - msoLogger.debug("Received request to Deactivate an Operational Environment"); - HashMap instanceIdMap = new HashMap(); - instanceIdMap.put("operationalEnvironmentId", operationalEnvironmentId); - return cloudOrchestration(request, Action.deactivate, instanceIdMap, version); - } - - - private Response cloudOrchestration(String requestJSON, Action action, HashMap instanceIdMap, String version) { - String requestId = UUIDChecker.generateUUID(msoLogger); - long startTime = System.currentTimeMillis (); - CloudOrchestrationRequest cor = null; - Response response = null; - getTenantIsolationRequest().setRequestId(requestId); - - try { - cor = convertJsonToCloudOrchestrationRequest(requestJSON, action, startTime, cor); - } catch(Exception e) { - response = getTenantIsolationRequest().buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, - "Mapping of request to JSON object failed. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, - null); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - try { - getTenantIsolationRequest().parse(cor, instanceIdMap, action); - } catch(Exception e) { - msoLogger.debug ("Validation failed: ", e); - if (getTenantIsolationRequest().getRequestId () != null) { - msoLogger.debug ("Logging failed message to the database"); - getTenantIsolationRequest().createRequestRecord (Status.FAILED, action); - } - response = getTenantIsolationRequest().buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, - "Error parsing request. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - String instanceName = cor.getRequestDetails().getRequestInfo().getInstanceName(); - String resourceType = cor.getRequestDetails().getRequestInfo().getResourceType().name(); - InfraActiveRequests dup = null; - String messageAppend = null; - try { - dup = duplicateCheck(action, instanceIdMap, startTime, instanceName, resourceType); - - if(dup != null) { - messageAppend = "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - " + dup.getRequestId() + ")."; - } - } catch(Exception e) { - response = getTenantIsolationRequest().buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, - MsoException.ServiceException, - e.getMessage(), - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null) ; - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - try { - if(dup == null && (Action.activate.equals(action) || Action.deactivate.equals(action))) { - dup = getRequestsDatabase().checkVnfIdStatus(cor.getOperationalEnvironmentId()); - if(dup != null) { - messageAppend = "OperationalEnvironmentId is not COMPLETED."; - } - } - } catch(Exception e) { - response = getTenantIsolationRequest().buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, - MsoException.ServiceException, - e.getMessage(), - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null) ; - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - if(dup != null) { - String instance = null; - if(instanceName != null){ - instance = instanceName; - }else{ - instance = instanceIdMap.get(resourceType + "InstanceId"); - } - String dupMessage = "Error: Locked instance - This " + resourceType + " (" + instance + ") " + messageAppend + " The existing request must finish or be cleaned up before proceeding."; - - response = getTenantIsolationRequest().buildServiceErrorResponse(HttpStatus.SC_CONFLICT, - MsoException.ServiceException, - dupMessage, - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null) ; - - msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError, dupMessage); - getTenantIsolationRequest().createRequestRecord (Status.FAILED, action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - String instanceId = null; - try { - if(instanceIdMap != null && instanceIdMap.get("operationalEnvironmentId") != null) { - instanceId = instanceIdMap.get("operationalEnvironmentId"); - } else { - instanceId = UUIDChecker.generateUUID(msoLogger); - getTenantIsolationRequest().setOperationalEnvironmentId(instanceId); - cor.setOperationalEnvironmentId(instanceId); - } - - msoLogger.debug("Creating record in Request DB"); - getTenantIsolationRequest().createRequestRecord(Status.IN_PROGRESS, action); - } catch(Exception e) { - response = getTenantIsolationRequest().buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR, - MsoException.ServiceException, - "Exception while creating record in DB " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, - null); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - try { - OperationalEnvironment opEnv = cor.getRequestDetails().getRequestParameters().getOperationalEnvironmentType(); - String operationalEnvType = opEnv != null ? opEnv.name() : null; - - TenantIsolationRunnable runnable = getThread(); - runnable.setAction(action); - runnable.setCor(cor); - runnable.setOperationalEnvType(operationalEnvType); - runnable.setRequestId(requestId); - - Thread thread = new Thread(runnable); - thread.start(); - } catch(Exception e) { - msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while creating a new Thread", "APIH", null, null); - response = getTenantIsolationRequest().buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR, - MsoException.ServiceException, - "Failed creating a Thread " + e.getMessage (), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - getTenantIsolationRequest().updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.UnknownError, "Exception while creating a new Thread"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, "Exception while creating a new Thread"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - try { - String encodedValue = new String(instanceId.getBytes("UTF-8")); - msoLogger.debug ("InstanceId: " + instanceId + " encoded to " + encodedValue); - - TenantSyncResponse tenantResponse = new TenantSyncResponse(); - RequestReferences reqReference = new RequestReferences(); - reqReference.setInstanceId(encodedValue); - reqReference.setRequestId(requestId); - tenantResponse.setRequestReferences(reqReference); - - response = Response.ok(tenantResponse).build(); - - msoLogger.debug ("Successful Sync response " + response.getEntity() + " with status code " + response.getStatus()); - - return response; - } catch(Exception e) { - msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while building sync response", "APIH", null, null); - response = getTenantIsolationRequest().buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR, - MsoException.ServiceException, - "Failed sending Sync Response " + e.getMessage (), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - getTenantIsolationRequest().updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.UnknownError, "Exception while sending sync Response"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, "Exception while sending sync Response"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - } - - private InfraActiveRequests duplicateCheck(Action action, HashMap instanceIdMap, long startTime, - String instanceName, String requestScope) throws Exception { - InfraActiveRequests dup = null; - try { - dup = getRequestsDatabase().checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Error during duplicate check"); - throw new Exception(e); - } - return dup; - } - - private CloudOrchestrationRequest convertJsonToCloudOrchestrationRequest(String requestJSON, Action action, long startTime, - CloudOrchestrationRequest cor) throws Exception { - CloudOrchestrationRequest new_cor = null; - try{ - msoLogger.debug("Converting incoming JSON request to Object"); - ObjectMapper mapper = new ObjectMapper(); - new_cor = mapper.readValue(requestJSON, CloudOrchestrationRequest.class); - } catch(Exception e){ - msoLogger.debug ("Mapping of request to JSON object failed : ", e); - if (getTenantIsolationRequest().getRequestId () != null) { - msoLogger.debug ("Mapping of request to JSON object failed"); - getTenantIsolationRequest().createRequestRecord (Status.FAILED, action); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); - throw new Exception(e); - } - return new_cor; - } - - public TenantIsolationRequest getTenantIsolationRequest() { - if(tenantIsolationRequest == null) { - tenantIsolationRequest = new TenantIsolationRequest(); - } - return tenantIsolationRequest; - } - - public void setTenantIsolationRequest(TenantIsolationRequest tenantIsolationRequest) { - this.tenantIsolationRequest = tenantIsolationRequest; - } - - public RequestsDatabase getRequestsDatabase() { - if(requestsDatabase == null) { - requestsDatabase = RequestsDatabase.getInstance(); - } - return requestsDatabase; - } - - public void setRequestsDatabase(RequestsDatabase requestsDatabase) { - this.requestsDatabase = requestsDatabase; - } - - public TenantIsolationRunnable getThread() { - if(tenantIsolation == null) { - tenantIsolation = new TenantIsolationRunnable(); - } - return tenantIsolation; - } - - public void setThread(TenantIsolationRunnable thread) { - this.tenantIsolation = thread; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java deleted file mode 100644 index 5e6c1ecd60..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation; - -import java.io.Serializable; - -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Distribution; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestDetails; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class CloudOrchestrationRequest implements Serializable { - - private static final long serialVersionUID = -4959169541182257787L; - @JsonProperty("requestDetails") - private RequestDetails requestDetails; - @JsonProperty("operationalEnvironmentId") - private String operationalEnvironmentId; - @JsonProperty("distribution") - private Distribution distribution; - @JsonProperty("distributionId") - private String distributionId; - - public String getOperationalEnvironmentId() { - return operationalEnvironmentId; - } - - public void setOperationalEnvironmentId(String operationalEnvironmentId) { - this.operationalEnvironmentId = operationalEnvironmentId; - } - - public RequestDetails getRequestDetails() { - return requestDetails; - } - - public void setRequestDetails(RequestDetails requestDetails){ - this.requestDetails = requestDetails; - } - - public Distribution getDistribution() { - return distribution; - } - - public void setDistribution(Distribution distribution) { - this.distribution = distribution; - } - - public String getDistributionId() { - return distributionId; - } - - public void setDistributionId(String distributionId) { - this.distributionId = distributionId; - } - - @Override - public String toString() { - return "ServiceInstancesRequest [requestDetails=" + requestDetails - + ", operationalEnvironmentId=" + operationalEnvironmentId - + ", distribution=" + distribution - + ", distributionId=" + distributionId + "]"; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java deleted file mode 100644 index a580a483c2..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java +++ /dev/null @@ -1,335 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import org.apache.http.HttpStatus; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.mso.apihandler.common.ErrorNumbers; -import org.openecomp.mso.apihandlerinfra.Constants; -import org.openecomp.mso.apihandlerinfra.Messages; -import org.openecomp.mso.apihandlerinfra.MsoException; -import org.openecomp.mso.apihandlerinfra.Status; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.CloudOrchestrationRequestList; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.CloudOrchestrationResponse; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.InstanceReferences; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Request; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestDetails; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestStatus; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.InfraActiveRequests; -import org.openecomp.mso.requestsdb.RequestsDatabase; -import org.openecomp.mso.utils.UUIDChecker; - -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; - -@Path("/cloudResourcesRequests") -@Api(value="/cloudResourcesRequests",description="API GET Requests for cloud resources - Tenant Isolation") -public class CloudResourcesOrchestration { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); - private RequestsDatabase requestsDB = null; - - @POST - @Path("/{version: [vV][1]}/{requestId}/unlock") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Unlock CloudOrchestration requests for a specified requestId") - public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) { - TenantIsolationRequest msoRequest = new TenantIsolationRequest(requestId); - InfraActiveRequests requestDB = null; - Request request = null; - CloudOrchestrationRequest cor = null; - - long startTime = System.currentTimeMillis (); - msoLogger.debug ("requestId is: " + requestId); - - try{ - ObjectMapper mapper = new ObjectMapper(); - cor = mapper.readValue(requestJSON, CloudOrchestrationRequest.class); - } catch(Exception e){ - msoLogger.debug ("Mapping of request to JSON object failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Mapping of request to JSON object failed. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Mapping of request to JSON object failed"); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - try{ - msoRequest.parseOrchestration(cor); - } catch (Exception e) { - msoLogger.debug ("Validation failed: ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Error parsing request. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Logging failed message to the database"); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - try { - requestDB = getRequestsDB().getRequestFromInfraActive(requestId); - - if(requestDB == null) { - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "Orchestration RequestId " + requestId + " is not found in DB", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - - }else{ - request = mapInfraActiveRequestToRequest(requestDB); - RequestStatus reqStatus = request.getRequestStatus(); - Status status = Status.valueOf(reqStatus.getRequestState()); - if(status == Status.IN_PROGRESS || status == Status.PENDING || status == Status.PENDING_MANUAL_TASK){ - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED); - reqStatus.setRequestState(Status.UNLOCKED.toString ()); - getRequestsDB().updateInfraStatus (requestId, - Status.UNLOCKED.toString (), - Constants.MODIFIED_BY_APIHANDLER); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "RequestId " + requestId + " has been unlocked"); - - }else{ - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, - "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - } - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - e.getMessage (), - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.getErrors().get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - - } - - return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build (); - } - - @GET - @Path("/{version:[vV][1]}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Get status of an Operational Environment based on filter criteria",response=Response.class) - public Response getOperationEnvironmentStatusFilter(@Context UriInfo ui, @PathParam("version") String version ) { - MsoLogger.setServiceName ("getOperationEnvironmentStatusFilter"); - UUIDChecker.generateUUID(msoLogger); - long startTime = System.currentTimeMillis (); - - MultivaluedMap queryParams = ui.getQueryParameters(); - List requestIdKey = queryParams.get("requestId"); - - if(queryParams.size() == 1 && requestIdKey != null) { - msoLogger.debug ("Entered requestId GET OperationalEnvironment Request"); - String requestId = requestIdKey.get(0); - - CloudOrchestrationResponse cloudOrchestrationGetResponse = new CloudOrchestrationResponse(); - TenantIsolationRequest tenantIsolationRequest = new TenantIsolationRequest (requestId); - InfraActiveRequests requestDB = null; - - try { - requestDB = getRequestsDB().getRequestFromInfraActive(requestId); - - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e); - // TODO Will need to set Status for tenantIsolationRequest - // tenantIsolationRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = tenantIsolationRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - e.getMessage (), - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.getErrors().get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - if(requestDB == null) { - Response resp = tenantIsolationRequest.buildServiceErrorResponse (HttpStatus.SC_NO_CONTENT, - MsoException.ServiceException, - "Orchestration RequestId " + requestId + " is not found in DB", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - Request request = mapInfraActiveRequestToRequest(requestDB); - cloudOrchestrationGetResponse.setRequest(request); - return Response.status(200).entity(cloudOrchestrationGetResponse).build(); - - } else { - msoLogger.debug ("Entered GET OperationalEnvironment filter Request"); - TenantIsolationRequest tenantIsolationRequest = new TenantIsolationRequest (); - List activeRequests = null; - CloudOrchestrationRequestList orchestrationList = null; - - try{ - Map orchestrationMap = tenantIsolationRequest.getOrchestrationFilters(queryParams); - activeRequests = getRequestsDB().getCloudOrchestrationFiltersFromInfraActive(orchestrationMap); - orchestrationList = new CloudOrchestrationRequestList(); - List requestLists = new ArrayList(); - - for(InfraActiveRequests infraActive : activeRequests){ - - Request request = mapInfraActiveRequestToRequest(infraActive); - CloudOrchestrationResponse requestList = new CloudOrchestrationResponse(); - requestList.setRequest(request); - requestLists.add(requestList); - } - orchestrationList.setRequestList(requestLists); - - }catch(Exception e){ - msoLogger.debug ("Get Orchestration Request with Filters Failed : ", e); - Response response = tenantIsolationRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, - "Get CloudOrchestration Request with Filters Failed. " + e.getMessage(), - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null); - msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Get CloudOrchestration Request with Filters Failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - return Response.status(200).entity(orchestrationList).build(); - } - } - - private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) { - Request request = new Request(); - request.setRequestId(requestDB.getRequestId()); - request.setRequestScope(requestDB.getRequestScope()); - request.setRequestType(requestDB.getRequestAction()); - - InstanceReferences ir = new InstanceReferences(); - - if(requestDB.getOperationalEnvId() != null) - ir.setOperationalEnvironmentId(requestDB.getOperationalEnvId()); - if(requestDB.getOperationalEnvName() != null) - ir.setOperationalEnvName(requestDB.getOperationalEnvName()); - if(requestDB.getRequestorId() != null) - ir.setRequestorId(requestDB.getRequestorId()); - - request.setInstanceReferences(ir); - String requestBody = requestDB.getRequestBody(); - RequestDetails requestDetails = null; - - try{ - ObjectMapper mapper = new ObjectMapper(); - requestDetails = mapper.readValue(requestBody, RequestDetails.class); - - }catch(Exception e){ - msoLogger.debug("Exception caught mapping requestBody to RequestDetails"); - } - - request.setRequestDetails(requestDetails); - String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + " GMT"; - request.setStartTime(startTimeStamp); - - RequestStatus status = new RequestStatus(); - if(requestDB.getStatusMessage() != null){ - status.setStatusMessage(requestDB.getStatusMessage()); - } - - if(requestDB.getEndTime() != null){ - String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + " GMT"; - status.setTimeStamp(endTimeStamp); - } - - if(requestDB.getRequestStatus() != null){ - status.setRequestState(requestDB.getRequestStatus()); - } - - if(requestDB.getProgress() != null){ - status.setPercentProgress(requestDB.getProgress().toString()); - } - - request.setRequestStatus(status); - - return request; - } - - public RequestsDatabase getRequestsDB() { - if(requestsDB == null) { - requestsDB = RequestsDatabase.getInstance(); - } - return requestsDB; - } - - public void setRequestsDB(RequestsDatabase requestsDB) { - this.requestsDB = requestsDB; - } - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java deleted file mode 100644 index fc6d1a551f..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation; - -import java.net.MalformedURLException; -import java.net.URL; - -import javax.ws.rs.core.MediaType; - -import org.openecomp.mso.apihandlerinfra.MsoPropertiesUtils; -import org.openecomp.mso.client.grm.GRMProperties; -import org.openecomp.mso.properties.MsoJavaProperties; - -public class GrmClientPropertiesImpl implements GRMProperties { - - final MsoJavaProperties props; - - public GrmClientPropertiesImpl() { - this.props = MsoPropertiesUtils.loadMsoProperties (); - } - - @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(props.getProperty("grm.endpoint", null)); - } - - @Override - public String getSystemName() { - return "MSO"; - } - - @Override - public String getDefaultVersion() { - return "v1"; - } - - @Override - public String getUsername() { - return props.getProperty("grm.username", null); - } - - @Override - public String getPassword() { - return props.getProperty("grm.password", null); - } - - @Override - public String getContentType() { - return MediaType.APPLICATION_JSON; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/ModelDistributionRequest.java deleted file mode 100644 index eb5306a155..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/ModelDistributionRequest.java +++ /dev/null @@ -1,160 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation; - -import java.util.List; - -import javax.ws.rs.Consumes; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.xml.bind.ValidationException; - -import org.apache.commons.lang3.StringUtils; -import org.apache.http.HttpStatus; -import org.openecomp.mso.apihandler.common.ErrorNumbers; -import org.openecomp.mso.apihandlerinfra.Constants; -import org.openecomp.mso.apihandlerinfra.MsoException; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Action; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Distribution; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Status; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.serviceinstancebeans.RequestError; -import org.openecomp.mso.serviceinstancebeans.ServiceException; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; -import com.wordnik.swagger.jaxrs.PATCH; - -@Path("/modelDistributions") -@Api(value="/modelDistributions",description="API Requests for Model Distributions") -public class ModelDistributionRequest { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - private TenantIsolationRunnable tenantIsolation = null; - - @PATCH - @Path("/{version:[vV][1]}/distributions/{distributionId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Update model distribution status",response=Response.class) - public Response updateModelDistributionStatus(String requestJSON, @PathParam("version") String version, @PathParam("distributionId") String distributionId) { - long startTime = System.currentTimeMillis (); - Distribution distributionRequest = null; - - try { - ObjectMapper mapper = new ObjectMapper(); - distributionRequest = mapper.readValue(requestJSON, Distribution.class); - } catch(Exception e) { - msoLogger.debug ("Mapping of request to JSON object failed : ", e); - Response response = buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, - "Mapping of request to JSON object failed. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - try { - parse(distributionRequest); - } catch(Exception e) { - msoLogger.debug ("Validation failed: ", e); - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - Response response = buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, - "Error parsing request. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - CloudOrchestrationRequest cor = new CloudOrchestrationRequest(); - cor.setDistribution(distributionRequest); - cor.setDistributionId(distributionId); - - TenantIsolationRunnable runnable = getThread(); - runnable.setAction(Action.distributionStatus); - runnable.setCor(cor); - runnable.setOperationalEnvType(null); - runnable.setRequestId(null); - - Thread thread = new Thread(runnable); - thread.start(); - - return Response.ok().build(); - } - - private void parse(Distribution distributionRequest) throws ValidationException { - if(distributionRequest.getStatus() == null) { - throw new ValidationException("status"); - } - - if(StringUtils.isBlank(distributionRequest.getErrorReason()) && Status.DISTRIBUTION_COMPLETE_ERROR.equals(distributionRequest.getStatus())) { - throw new ValidationException("errorReason"); - } - } - - private Response buildServiceErrorResponse (int httpResponseCode, MsoException exceptionType, String text, - String messageId, List variables) { - RequestError re = new RequestError(); - ServiceException se = new ServiceException(); - se.setMessageId(messageId); - se.setText(text); - if(variables != null){ - if(variables != null){ - for(String variable: variables){ - se.getVariables().add(variable); - } - } - } - re.setServiceException(se); - - String requestErrorStr = null; - try{ - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_DEFAULT); - requestErrorStr = mapper.writeValueAsString(re); - }catch(Exception e){ - msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in buildServiceErrorResponse writing exceptionType to string ", e); - } - - return Response.status (httpResponseCode).entity(requestErrorStr).build (); - } - - public TenantIsolationRunnable getThread() { - if(tenantIsolation == null) { - tenantIsolation = new TenantIsolationRunnable(); - } - return tenantIsolation; - } - - public void setThread(TenantIsolationRunnable thread) { - this.tenantIsolation = thread; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/OperationalEnvironmentProcessFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/OperationalEnvironmentProcessFactory.java deleted file mode 100644 index e39c1d7ef1..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/OperationalEnvironmentProcessFactory.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation; - -import org.openecomp.mso.apihandlerinfra.tenantisolation.process.ActivateVnfOperationalEnvironment; -import org.openecomp.mso.apihandlerinfra.tenantisolation.process.ActivateVnfStatusOperationalEnvironment; -import org.openecomp.mso.apihandlerinfra.tenantisolation.process.CreateEcompOperationalEnvironment; -import org.openecomp.mso.apihandlerinfra.tenantisolation.process.CreateVnfOperationalEnvironment; -import org.openecomp.mso.apihandlerinfra.tenantisolation.process.DeactivateVnfOperationalEnvironment; -import org.openecomp.mso.apihandlerinfra.tenantisolation.process.OperationalEnvironmentProcess; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Action; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.OperationalEnvironment; - -public class OperationalEnvironmentProcessFactory { - - public OperationalEnvironmentProcess getOperationalEnvironmentProcess(Action action, String operationalEnvType, CloudOrchestrationRequest cor, String requestId) throws Exception{ - - if(Action.create.equals(action)) { - if(OperationalEnvironment.ECOMP.name().equalsIgnoreCase(operationalEnvType)) { - return new CreateEcompOperationalEnvironment(cor, requestId); - } else if(OperationalEnvironment.VNF.name().equalsIgnoreCase(operationalEnvType)) { - return new CreateVnfOperationalEnvironment(cor, requestId); - } else { - throw new Exception("Invalid OperationalEnvironment Type specified for Create Action"); - } - } else if(Action.activate.equals(action)) { - return new ActivateVnfOperationalEnvironment(cor, requestId); - } else if(Action.deactivate.equals(action)) { - return new DeactivateVnfOperationalEnvironment(cor, requestId); - } else if(Action.distributionStatus.equals(action)) { - return new ActivateVnfStatusOperationalEnvironment(cor, requestId); - } else { - throw new Exception("Invalid Action specified: " + action); - } - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRequest.java deleted file mode 100644 index ce9d7b3a30..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRequest.java +++ /dev/null @@ -1,476 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation; - -import java.sql.Timestamp; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; - -import org.apache.commons.lang3.StringUtils; -import org.hibernate.Session; -import org.openecomp.mso.apihandler.common.ValidationException; -import org.openecomp.mso.apihandlerinfra.Constants; -import org.openecomp.mso.apihandlerinfra.MsoException; -import org.openecomp.mso.apihandlerinfra.Status; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Action; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Manifest; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.OperationalEnvironment; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RelatedInstance; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RelatedInstanceList; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestDetails; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestInfo; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestParameters; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.ResourceType; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.ServiceModelList; -import org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType; -import org.openecomp.mso.db.AbstractSessionFactoryManager; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.InfraActiveRequests; -import org.openecomp.mso.requestsdb.RequestsDatabase; -import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager; -import org.openecomp.mso.serviceinstancebeans.PolicyException; -import org.openecomp.mso.serviceinstancebeans.RequestError; -import org.openecomp.mso.serviceinstancebeans.ServiceException; -import org.openecomp.mso.utils.UUIDChecker; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class TenantIsolationRequest { - - private String requestId; - private String requestJSON; - private RequestInfo requestInfo; - - private String errorMessage; - private String errorCode; - private String httpResponse; - private String responseBody; - private RequestStatusType status; - private CloudOrchestrationRequest cor; - private String operationalEnvironmentId; - private long progress = Constants.PROGRESS_REQUEST_RECEIVED; - private String requestScope; - - - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager (); - - TenantIsolationRequest (String requestId) { - this.requestId = requestId; - MsoLogger.setLogContext (requestId, null); - } - - TenantIsolationRequest () { - MsoLogger.setLogContext (requestId, null); - } - - void parse(CloudOrchestrationRequest request, HashMap instanceIdMap, Action action) throws ValidationException { - msoLogger.debug ("Validating the Cloud Orchestration request"); - this.cor = request; - this.requestInfo = request.getRequestDetails().getRequestInfo(); - - try{ - ObjectMapper mapper = new ObjectMapper(); - requestJSON = mapper.writeValueAsString(request.getRequestDetails()); - - } catch(Exception e){ - throw new ValidationException ("Parse ServiceInstanceRequest to JSON string"); - } - - String envId = null; - if(instanceIdMap != null) { - envId = instanceIdMap.get("operationalEnvironmentId"); - if(envId != null && !UUIDChecker.isValidUUID (envId)){ - throw new ValidationException ("operationalEnvironmentId"); - } - cor.setOperationalEnvironmentId(envId); - } - - this.operationalEnvironmentId = envId; - - RequestDetails requestDetails = request.getRequestDetails(); - RequestParameters requestParameters = requestDetails.getRequestParameters(); - - requestInfoValidation(action, requestInfo); - - requestParamsValidation(action, requestParameters); - - relatedInstanceValidation(action, requestDetails, requestParameters); - - } - - private void relatedInstanceValidation(Action action, RequestDetails requestDetails, RequestParameters requestParameters) throws ValidationException { - RelatedInstanceList[] instanceList = requestDetails.getRelatedInstanceList(); - - if((Action.activate.equals(action) || Action.deactivate.equals(action)) && OperationalEnvironment.ECOMP.equals(requestParameters.getOperationalEnvironmentType())) { - throw new ValidationException("operationalEnvironmentType in requestParameters"); - } - - if(!Action.deactivate.equals(action) && OperationalEnvironment.VNF.equals(requestParameters.getOperationalEnvironmentType())) { - if(instanceList != null && instanceList.length > 0) { - for(RelatedInstanceList relatedInstanceList : instanceList){ - RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); - - if(relatedInstance.getResourceType() == null) { - throw new ValidationException("ResourceType in relatedInstance"); - } - - if(!empty(relatedInstance.getInstanceName()) && !relatedInstance.getInstanceName().matches(Constants.VALID_INSTANCE_NAME_FORMAT)) { - throw new ValidationException ("instanceName format"); - } - - if (empty (relatedInstance.getInstanceId ())) { - throw new ValidationException ("instanceId in relatedInstance"); - } - - if (!UUIDChecker.isValidUUID (relatedInstance.getInstanceId ())) { - throw new ValidationException ("instanceId format in relatedInstance"); - } - } - } else { - throw new ValidationException ("relatedInstanceList"); - } - } - } - - private void requestParamsValidation(Action action, RequestParameters requestParameters) throws ValidationException { - - if(requestParameters != null) { - if(!Action.deactivate.equals(action) && requestParameters.getOperationalEnvironmentType() == null) { - throw new ValidationException ("OperationalEnvironmentType"); - } - - if (Action.create.equals(action) && empty(requestParameters.getTenantContext())) { - throw new ValidationException ("Tenant Context"); - } - if (!Action.deactivate.equals(action) && empty(requestParameters.getWorkloadContext())) { - throw new ValidationException ("Workload Context"); - } - - Manifest manifest = requestParameters.getManifest(); - - if(Action.activate.equals(action)) { - if(manifest == null) { - throw new ValidationException ("Manifest on Activate"); - } else { - List serviceModelList = manifest.getServiceModelList(); - - if(serviceModelList.size() == 0) { - throw new ValidationException (" empty ServiceModelList"); - } - - for(ServiceModelList list : serviceModelList) { - if(empty(list.getServiceModelVersionId())) { - throw new ValidationException ("ServiceModelVersionId"); - } - - if (!UUIDChecker.isValidUUID (list.getServiceModelVersionId())) { - throw new ValidationException ("ServiceModelVersionId format"); - } - - if(list.getRecoveryAction() == null) { - throw new ValidationException ("RecoveryAction"); - } - } - } - } - } else if(!Action.deactivate.equals(action)) { - throw new ValidationException("request Parameters"); - } - } - - private void requestInfoValidation(Action action, RequestInfo requestInfo) throws ValidationException { - - if(Action.create.equals(action) && empty(requestInfo.getInstanceName())) { - throw new ValidationException ("instanceName"); - } - - if(!empty(requestInfo.getInstanceName()) && !requestInfo.getInstanceName().matches(Constants.VALID_INSTANCE_NAME_FORMAT)) { - throw new ValidationException ("instanceName format"); - } - - if (empty(requestInfo.getSource())) { - throw new ValidationException ("source"); - } - - if(empty(requestInfo.getRequestorId())) { - throw new ValidationException ("requestorId"); - } - - ResourceType resourceType = requestInfo.getResourceType(); - if(resourceType == null) { - throw new ValidationException ("resourceType"); - } - - this.requestScope = resourceType.name(); - } - - void parseOrchestration (CloudOrchestrationRequest cor) throws ValidationException { - - msoLogger.debug ("Validating the Orchestration request"); - - this.cor = cor; - - try{ - ObjectMapper mapper = new ObjectMapper(); - //mapper.configure(Feature.WRAP_ROOT_VALUE, true); - requestJSON = mapper.writeValueAsString(cor.getRequestDetails()); - - } catch(Exception e){ - throw new ValidationException ("Parse CloudOrchestrationRequest to JSON string", e); - } - - this.requestInfo = cor.getRequestDetails().getRequestInfo(); - - if (this.requestInfo == null) { - throw new ValidationException ("requestInfo"); - } - - if (empty (requestInfo.getSource ())) { - throw new ValidationException ("source"); - } - if (empty (requestInfo.getRequestorId ())) { - throw new ValidationException ("requestorId"); - } - } - - public void createRequestRecord (Status status, Action action) { - Session session = null; - try { - - session = requestsDbSessionFactoryManager.getSessionFactory ().openSession (); - session.beginTransaction (); - - if (null == cor) { - cor = new CloudOrchestrationRequest(); - } - - InfraActiveRequests aq = new InfraActiveRequests (); - aq.setRequestId (requestId); - - aq.setRequestAction(action.name()); - aq.setAction(action.name()); - - Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis()); - - aq.setStartTime (startTimeStamp); - - if (requestInfo != null) { - - if(requestInfo.getSource() != null){ - aq.setSource(requestInfo.getSource()); - } - if(requestInfo.getRequestorId() != null) { - aq.setRequestorId(requestInfo.getRequestorId()); - } - if(requestInfo.getResourceType() != null) { - aq.setRequestScope(requestInfo.getResourceType().name()); - } - } - - if(ResourceType.operationalEnvironment.name().equalsIgnoreCase(requestScope)) { - aq.setOperationalEnvId(operationalEnvironmentId); - aq.setOperationalEnvName(requestInfo.getInstanceName()); - } - - aq.setRequestBody (this.requestJSON); - - aq.setRequestStatus (status.toString ()); - aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER); - - if ((status == Status.FAILED) || (status == Status.COMPLETE)) { - aq.setStatusMessage (this.errorMessage); - aq.setResponseBody (this.responseBody); - aq.setProgress(new Long(100)); - - Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis()); - aq.setEndTime (endTimeStamp); - } else if(status == Status.IN_PROGRESS) { - aq.setProgress(Constants.PROGRESS_REQUEST_IN_PROGRESS); - } - - msoLogger.debug ("About to insert a record"); - - session.save (aq); - session.getTransaction ().commit (); - session.close (); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request", e); - if (session != null) { - session.close (); - } - if (!status.equals (Status.FAILED)) { - throw e; - } - } - } - - - public Map getOrchestrationFilters (MultivaluedMap queryParams) throws ValidationException { - String queryParam = null; - Map orchestrationFilterParams = new HashMap(); - - for (Entry> entry : queryParams.entrySet()) { - queryParam = entry.getKey(); - try{ - for(String value : entry.getValue()) { - if(StringUtils.isBlank(value)) { - throw new Exception(queryParam + " value"); - } - orchestrationFilterParams.put(queryParam, value); - } - }catch(Exception e){ - throw new ValidationException (e.getMessage()); - } - } - - return orchestrationFilterParams; - } - - /** - * Build Error Response for Exception handling. - * - * @param int - * @param httpResponseCode the HTTP response code - * @param exceptionType. - * @param text the error description - * @param messageId - * @return the web service response - * - */ - public Response buildServiceErrorResponse (int httpResponseCode, - MsoException exceptionType, - String text, - String messageId, - List variables) { - - this.errorCode = messageId; - - if (text != null) { - this.errorMessage = text; - } - else { - this.errorMessage = ""; - } - this.httpResponse = Integer.toString(httpResponseCode); - if(errorMessage.length() > 1999){ - errorMessage = errorMessage.substring(0, 1999); - } - - RequestError re = new RequestError(); - - if(exceptionType.name().equals("PolicyException")){ - - PolicyException pe = new PolicyException(); - pe.setMessageId(messageId); - pe.setText(text); - if(variables != null){ - for(String variable: variables){ - pe.getVariables().add(variable); - } - } - re.setPolicyException(pe); - - } else { - - ServiceException se = new ServiceException(); - se.setMessageId(messageId); - se.setText(text); - if(variables != null){ - if(variables != null){ - for(String variable: variables){ - se.getVariables().add(variable); - } - } - } - re.setServiceException(se); - } - - String requestErrorStr = null; - - try{ - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_DEFAULT); - requestErrorStr = mapper.writeValueAsString(re); - }catch(Exception e){ - msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in buildServiceErrorResponse writing exceptionType to string ", e); - } - - - return Response.status (httpResponseCode).entity(requestErrorStr).build (); - - } - - private static boolean empty(String s) { - return (s == null || s.trim().isEmpty()); - } - - public String getRequestId () { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public void updateFinalStatus(Status failed) { - try { - (RequestsDatabase.getInstance()).updateInfraFinalStatus (requestId, - status.toString (), - this.errorMessage, - this.progress, - this.responseBody, - Constants.MODIFIED_BY_APIHANDLER); - } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception when updating record in DB"); - msoLogger.debug ("Exception: ", e); - } - } - - public void setStatus (RequestStatusType status) { - this.status = status; - switch (status) { - case FAILED: - case COMPLETE: - this.progress = Constants.PROGRESS_REQUEST_COMPLETED; - break; - case IN_PROGRESS: - this.progress = Constants.PROGRESS_REQUEST_IN_PROGRESS; - break; - } - } - - public String getOperationalEnvironmentId() { - return operationalEnvironmentId; - } - - public void setOperationalEnvironmentId(String operationalEnvironmentId) { - this.operationalEnvironmentId = operationalEnvironmentId; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java deleted file mode 100644 index 167b88fbc8..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation; - -import org.openecomp.mso.apihandlerinfra.Constants; -import org.openecomp.mso.apihandlerinfra.tenantisolation.process.OperationalEnvironmentProcess; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Action; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.RequestsDBHelper; - -public class TenantIsolationRunnable implements Runnable { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - private OperationalEnvironmentProcessFactory factory = null; - private Action action; - private String operationalEnvType; - private CloudOrchestrationRequest cor; - private String requestId; - protected RequestsDBHelper requestDb; - - @Override - public void run() { - msoLogger.debug ("Starting threadExecution in TenantIsolationRunnable for Action " + action.name() + " and OperationalEnvType: " + operationalEnvType); - try { - OperationalEnvironmentProcess isolation = getFactory().getOperationalEnvironmentProcess(action, operationalEnvType, cor, requestId); - isolation.execute(); - } catch(Exception e) { - msoLogger.debug ("Exception during Thread initiation: ", e); - msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.UnknownError, null, e); - getRequestDb().updateInfraFailureCompletion(e.getMessage(), requestId, cor.getOperationalEnvironmentId()); - } - } - - public Action getAction() { - return action; - } - - public void setAction(Action action) { - this.action = action; - } - - public String getOperationalEnvType() { - return operationalEnvType; - } - - public void setOperationalEnvType(String operationalEnvType) { - this.operationalEnvType = operationalEnvType; - } - - public CloudOrchestrationRequest getCor() { - return cor; - } - - public void setCor(CloudOrchestrationRequest cor) { - this.cor = cor; - } - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public OperationalEnvironmentProcessFactory getFactory() { - if(factory == null) { - factory = new OperationalEnvironmentProcessFactory(); - } - return factory; - } - - public void setFactory(OperationalEnvironmentProcessFactory factory) { - this.factory = factory; - } - - protected RequestsDBHelper getRequestDb() { - if(requestDb == null) { - requestDb = new RequestsDBHelper(); - } - return requestDb; - } - - protected void setRequestsDBHelper(RequestsDBHelper helper) { - this.requestDb = helper; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java deleted file mode 100644 index 1f3457e6e0..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java +++ /dev/null @@ -1,172 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap; - - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"operationalEnvironmentId", -"operationalEnvironmentName", -"operationalEnvironmentType", -"tenantContext", -"workloadContext" -}) - -public class CreateEcompOperationEnvironmentBean { - -@JsonProperty("operationalEnvironmentId") -private String operationalEnvironmentId; -@JsonProperty("operationalEnvironmentName") -private String operationalEnvironmentName; -@JsonProperty("operationalEnvironmentType") -private String operationalEnvironmentType; -@JsonProperty("tenantContext") -private String tenantContext; -@JsonProperty("workloadContext") -private String workloadContext; -@JsonProperty("action") -private String action; - - -/** -* No args constructor for use in serialization -* -*/ -public CreateEcompOperationEnvironmentBean() { - } - -/** -* -* @param operationalEnvironmentId -* @param operationalEnvironmentName -* @param operationalEnvironmentType -* @param tenantContext -* @param workloadContext -*/ -public CreateEcompOperationEnvironmentBean(String operationalEnvironmentId, String operationalEnvironmentName, String operationalEnvironmentType, String tenantContext, String workloadContext, String action) { -super(); -this.operationalEnvironmentId = operationalEnvironmentId; -this.operationalEnvironmentName = operationalEnvironmentName; -this.operationalEnvironmentType = operationalEnvironmentType; -this.tenantContext = tenantContext; -this.workloadContext = workloadContext; -this.action = action; - } - -@JsonProperty("operationalEnvironmentId") -public String getOperationalEnvironmentId() { -return operationalEnvironmentId; - } - -@JsonProperty("operationalEnvironmentId") -public void setOperationalEnvironmentId(String operationalEnvironmentId) { -this.operationalEnvironmentId = operationalEnvironmentId; - } - -public CreateEcompOperationEnvironmentBean withOperationalEnvironmentId(String operationalEnvironmentId) { -this.operationalEnvironmentId = operationalEnvironmentId; -return this; - } - - -@JsonProperty("operationalEnvironmentName") -public String getoperationalEnvironmentName() { -return operationalEnvironmentName; - } - -@JsonProperty("operationalEnvironmentName") -public void setoperationalEnvironmentName(String operationalEnvironmentName) { -this.operationalEnvironmentName = operationalEnvironmentName; - } - -public CreateEcompOperationEnvironmentBean withOperationalEnvironmentName(String operationalEnvironmentName) { -this.operationalEnvironmentName = operationalEnvironmentName; -return this; - } - -@JsonProperty("operationalEnvironmentType") -public String getoperationalEnvironmentType() { -return operationalEnvironmentType; - } - -@JsonProperty("operationalEnvironmentType") -public void setoperationalEnvironmentType(String operationalEnvironmentType) { -this.operationalEnvironmentType = operationalEnvironmentType; - } - -public CreateEcompOperationEnvironmentBean withOperationalEnvironmentType(String operationalEnvironmentType) { -this.operationalEnvironmentType = operationalEnvironmentType; -return this; - } - -@JsonProperty("tenantContext") -public String gettenantContext() { -return tenantContext; - } - -@JsonProperty("tenantContext") -public void settenantContext(String tenantContext) { -this.tenantContext = tenantContext; - } - -public CreateEcompOperationEnvironmentBean withTenantContext(String tenantContext) { -this.tenantContext = tenantContext; -return this; - } - -@JsonProperty("workloadContext") -public String getworkloadContext() { -return workloadContext; - } - -@JsonProperty("workloadContext") -public void setworkloadContext(String workloadContext) { -this.workloadContext = workloadContext; - } - -public CreateEcompOperationEnvironmentBean withWorkloadContext(String workloadContext) { -this.workloadContext = workloadContext; -return this; - } - - -@JsonProperty("action") -public String getaction() { -return action; - } - -@JsonProperty("action") -public void setaction(String action) { -this.action = action; - } - -public CreateEcompOperationEnvironmentBean withaction(String action) { -this.action = action; -return this; - } - - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java deleted file mode 100644 index 4d47acdd22..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap; - -import java.io.IOException; - - -import org.openecomp.mso.client.dmaap.DmaapPublisher; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class DmaapOperationalEnvClient { - - - protected String buildRequest(String operationalEnvironmentId, String operationalEnvironmentName, String operationalEnvironmentType, String tenantContext, String workloadContext, String action ) - throws JsonProcessingException { - final CreateEcompOperationEnvironmentBean operationalEnv = new CreateEcompOperationEnvironmentBean(); - operationalEnv.withOperationalEnvironmentId(operationalEnvironmentId) - .withOperationalEnvironmentName(operationalEnvironmentName) - .withOperationalEnvironmentType(operationalEnvironmentType) - .withTenantContext(tenantContext) - .withWorkloadContext(workloadContext) - .withaction(action); - - return this.getJson(operationalEnv); - - } - - protected String getJson(CreateEcompOperationEnvironmentBean obj) throws JsonProcessingException { - - final ObjectMapper mapper = new ObjectMapper(); - return mapper.writeValueAsString(obj); - - } - - protected DmaapPublisher getPublisher() throws IOException { - return new OperationalEnvironmentPublisher(); - } - - public void dmaapPublishOperationalEnvRequest(String operationalEnvironmentId, String operationalEnvironmentName, String operationalEnvironmentType, - String tenantContext, String workloadContext, String action ) throws Exception { - - String request = this.buildRequest(operationalEnvironmentId, operationalEnvironmentName, operationalEnvironmentType, tenantContext, workloadContext, action); - final DmaapPublisher publisher = this.getPublisher(); - publisher.send(request); - - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java deleted file mode 100644 index 3ce4759577..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap; - -import java.util.Map; - -import org.openecomp.mso.apihandlerinfra.MsoPropertiesUtils; -import org.openecomp.mso.client.dmaap.DmaapProperties; -import org.openecomp.mso.properties.MsoJavaProperties; - -public class DmaapPropertiesImpl implements DmaapProperties { - - private final Map props; - - public DmaapPropertiesImpl () { - - MsoJavaProperties properties = MsoPropertiesUtils.loadMsoProperties(); - this.props = properties.asMap(); - } - - @Override - public Map getProperties() { - - return this.props; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java deleted file mode 100644 index 36c1085655..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Optional; - -import org.openecomp.mso.client.dmaap.DmaapPublisher; - -public class OperationalEnvironmentPublisher extends DmaapPublisher { - - - public OperationalEnvironmentPublisher() throws FileNotFoundException, IOException { - super(); - } - - @Override - public String getUserName() { - - return this.msoProperties.get("so.operational-environment.dmaap.username"); - } - - @Override - public String getPassword() { - - return this.msoProperties.get("so.operational-environment.dmaap.password"); - } - - @Override - public String getTopic() { - - return this.msoProperties.get("so.operational-environment.publisher.topic"); - } - - @Override - public Optional getHost() { - return Optional.ofNullable(this.msoProperties.get("so.operational-environment.dmaap.host")); - } -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java deleted file mode 100644 index 993c7dc9b7..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions; - -public class AAIClientCallFailed extends Exception { - - public AAIClientCallFailed(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AsdcClientCallFailed.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AsdcClientCallFailed.java deleted file mode 100644 index 3e9009d2e3..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AsdcClientCallFailed.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions; - -public class AsdcClientCallFailed extends Exception { - - public AsdcClientCallFailed(String message, Throwable cause) { - super(message, cause); - } - - public AsdcClientCallFailed(String message) { - super(message); - } - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/TenantIsolationException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/TenantIsolationException.java deleted file mode 100644 index 279a93e1b7..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/TenantIsolationException.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions; - -public class TenantIsolationException extends Exception { - - private static final long serialVersionUID = 6948152225371031774L; - - public TenantIsolationException() { - super(); - - } - - public TenantIsolationException(String msg) { - super ("Tenant Isolation error: " + msg); - - } -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java deleted file mode 100644 index c431da66ee..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java +++ /dev/null @@ -1,145 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.helpers; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Map; - -import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.AAIClientCallFailed; -import org.openecomp.mso.client.aai.AAIObjectType; -import org.openecomp.mso.client.aai.AAIResourcesClient; -import org.openecomp.mso.client.aai.entities.AAIResultWrapper; -import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri; -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; -import org.openecomp.mso.client.aai.entities.uri.Depth; -import org.openecomp.mso.client.aai.objects.AAIOperationalEnvironment; -import org.openecomp.mso.logger.MsoLogger; - -public class AAIClientHelper { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - - public AAIClientHelper() { - super(); - } - - public AAIClientHelper(String serviceName, String requestId) { - super(); - MsoLogger.setServiceName (serviceName); - MsoLogger.setLogContext(requestId, ""); - } - - /** - * Get managing ECOMP Environment Info from A&AI - * @param id = operationalEnvironmentId - * @return AAIResultWrapper object - */ - public AAIResultWrapper getAaiOperationalEnvironment(String id) throws Exception { - try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, id); - uri.depth(Depth.ZERO); //Do not return relationships if any - AAIResourcesClient aaiClient = this.getClient(); - AAIResultWrapper result = aaiClient.get(uri); - return result; - } - catch(Exception ex) { - logStackTrace(ex); - throw new AAIClientCallFailed("Call to A&AI failed!", ex); - } - } - - - /** - * Update managing ECOMP Environment Info from A&AI - * @param id = operationalEnvironmentId - * @param AAIOperationalEnvironment object - */ - public void updateAaiOperationalEnvironment(String id, AAIOperationalEnvironment aaiRequest) throws Exception { - try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, id); - AAIResourcesClient aaiClient = this.getClient(); - aaiClient.update(uri, aaiRequest); - } - catch(Exception ex) { - logStackTrace(ex); - throw new AAIClientCallFailed("Call to A&AI failed!", ex); - } - } - - - public void updateAaiOperationalEnvironment(String operationalEnvironmentId, Map payload) throws Exception { - try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, operationalEnvironmentId); - AAIResourcesClient aaiClient = this.getClient(); - aaiClient.update(uri, payload); - } - catch(Exception ex) { - logStackTrace(ex); - throw new AAIClientCallFailed("Call to A&AI failed!", ex); - } - } - - /** - * Create an Operational Environment object in A&AI - * @param AAIOperationalEnvironment object - */ - public void createOperationalEnvironment(AAIOperationalEnvironment operationalEnvironment) throws Exception { - try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, operationalEnvironment.getOperationalEnvironmentId()); - AAIResourcesClient aaiClient = this.getClient(); - aaiClient.create(uri, operationalEnvironment); - } - catch(Exception ex) { - logStackTrace(ex); - throw new AAIClientCallFailed("Call to A&AI failed!", ex); - } - } - - /** - * Create a relationship between ECOMP managing and VNF Operational Environments - * @param managingEcompOperationalEnvironmentId - * @param vnfOperationalEnvironmentId - * @throws Exception - */ - public void createRelationship(String managingEcompOperationalEnvironmentId, String vnfOperationalEnvironmentId) throws Exception { - try { - AAIResourceUri ecompEnvUri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, managingEcompOperationalEnvironmentId); - AAIResourceUri vnfEnvUri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, vnfOperationalEnvironmentId); - AAIResourcesClient aaiClient = this.getClient(); - aaiClient.connect(vnfEnvUri, ecompEnvUri); - } - catch(Exception ex) { - logStackTrace(ex); - throw new AAIClientCallFailed("Call to A&AI failed!", ex); - } - } - - private void logStackTrace(Exception e) { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - msoLogger.debug(sw.toString()); - } - - protected AAIResourcesClient getClient() { - return new AAIResourcesClient(); - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java deleted file mode 100644 index 58b78d7e8b..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.helpers; - -import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; -import org.openecomp.mso.client.aai.objects.AAIOperationalEnvironment; - -public class AAIClientObjectBuilder { - - private CloudOrchestrationRequest cloudOrchestrationRequest; - - public AAIClientObjectBuilder(CloudOrchestrationRequest request) { - this.cloudOrchestrationRequest = request; - } - - /** - * Create an AAIOperationalEnvironment object. - * @param environmentId - * @param environmentName - * @param environmentType - * @param envrionmentStatus - * @param tenantContext - * @param workloadContext - * @return - * @throws JsonProcessingException - */ - @Deprecated - public static AAIOperationalEnvironment createAAIOperationalEnvironment( - String environmentId, - String environmentName, - String environmentType, - String envrionmentStatus, - String tenantContext, - String workloadContext) { - - AAIOperationalEnvironment oe = new AAIOperationalEnvironment(); - oe.setOperationalEnvironmentId(environmentId); - oe.setOperationalEnvironmentName(environmentName); - oe.setOperationalEnvironmentType(environmentType); - oe.setOperationalEnvironmentStatus(envrionmentStatus); - oe.setTenantContext(tenantContext); - oe.setWorkloadContext(workloadContext); - - return oe; - } - - - public AAIOperationalEnvironment buildAAIOperationalEnvironment(String status) { - AAIOperationalEnvironment env = new AAIOperationalEnvironment(); - env.setOperationalEnvironmentId(this.cloudOrchestrationRequest.getOperationalEnvironmentId()); - env.setOperationalEnvironmentName(this.cloudOrchestrationRequest.getRequestDetails().getRequestInfo().getInstanceName()); - env.setOperationalEnvironmentType(this.cloudOrchestrationRequest.getRequestDetails().getRequestParameters().getOperationalEnvironmentType().toString()); - env.setOperationalEnvironmentStatus(status); - env.setTenantContext(this.cloudOrchestrationRequest.getRequestDetails().getRequestParameters().getTenantContext()); - env.setWorkloadContext(this.cloudOrchestrationRequest.getRequestDetails().getRequestParameters().getWorkloadContext()); - return env; - } - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AsdcClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AsdcClientHelper.java deleted file mode 100644 index 2575013609..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AsdcClientHelper.java +++ /dev/null @@ -1,216 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.helpers; - -import java.util.UUID; - -import javax.ws.rs.core.UriBuilder; - -import org.json.JSONObject; -import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.AsdcClientCallFailed; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient; -import org.openecomp.mso.rest.RESTConfig; - -public class AsdcClientHelper { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - private String className = this.getClass().getSimpleName(); - private String methodName = ""; - private String classMethodMessage = ""; - - private JSONObject asdcResponseJsonObj; - - protected MsoJavaProperties properties; - - public static final String ASDC_CONTENT_TYPE = "application/json"; - public static final String ASDC_ACCEPT_TYPE = "application/json"; - - protected String instanceid; - protected String userid; - protected String asdcEndpoint; - protected String basicAuthCred; - protected String uri; - - public static String PARTIAL_ASDC_URI = "/sdc/v1/catalog/services/"; - - public AsdcClientHelper(MsoJavaProperties properties) { - this.properties = properties; - setAsdcProperties(); - - }; - - /** - * properties should be set during instantiation of this object - */ - private void setAsdcProperties() { - String asdcClientAuth = this.properties.getProperty("mso.asdc.client.auth", null); - String msoKey = this.properties.getProperty("mso.msoKey", null); - this.basicAuthCred = this.properties.decrypt(asdcClientAuth, msoKey); - this.asdcEndpoint = this.properties.getProperty("asdc.endpoint", null); - this.userid = this.properties.getProperty("asdc.activate.userid", null); - this.instanceid = this.properties.getProperty("asdc.activate.instanceid", null); - - } - - /** - * Send POST request to ASDC for operational activation - * @param uri - /sdc/v1/catalog/services/{serviceUUID}/distribution/{opEnvId}/activate - * @param jsonPayload - json string value of 'workloadContext'. - * @return JSONObject - */ - public JSONObject postActivateOperationalEnvironment(String serviceModelVersionId, String operationalEnvironmentId, String workloadContext) { - - try { - - String url = this.buildUriBuilder(serviceModelVersionId, operationalEnvironmentId); - msoLogger.debug(" ASDC url : " + url); - String jsonPayload = this.buildJsonWorkloadContext(workloadContext); - msoLogger.debug(" ASDC jsonPayload : " + jsonPayload); - asdcResponseJsonObj = new JSONObject(); - - if ( basicAuthCred == null || "".equals(basicAuthCred) ) { - String errorMessage = " ** ERROR: ASDC credentials 'mso.asdc.client.auth' not setup in properties file!"; - throw new AsdcClientCallFailed(errorMessage); - } - - RESTConfig config = new RESTConfig(url); - RESTClient client = setRestClient(config); - client.addAuthorizationHeader(basicAuthCred); - - APIResponse apiResponse = setHttpPostResponse(client, jsonPayload); - int statusCode = apiResponse.getStatusCode(); - msoLogger.debug(" ASDC return code : " + statusCode); - String responseData = apiResponse.getResponseBodyAsString(); - msoLogger.debug(" ASDC responseData : " + responseData); - asdcResponseJsonObj = enhanceJsonResponse(new JSONObject(responseData), statusCode); - - } catch (Exception ex) { - msoLogger.debug("calling ASDC Exception message: " + ex.getMessage()); - String errorMessage = " Encountered Error while calling ASDC POST Activate. " + ex.getMessage(); - msoLogger.debug(errorMessage); - asdcResponseJsonObj.put("statusCode", "500"); - asdcResponseJsonObj.put("messageId", ""); - asdcResponseJsonObj.put("message", errorMessage); - - } - return asdcResponseJsonObj; - - } - - /** - * set RESTClient - * @return RestClient object - */ - public RESTClient setRestClient(RESTConfig config) throws Exception { - - RESTClient client = new RESTClient(config).addHeader("X-ECOMP-InstanceID", instanceid) - .addHeader("X-ECOMP-RequestID", UUID.randomUUID().toString()) - .addHeader("Content-Type", AsdcClientHelper.ASDC_CONTENT_TYPE) - .addHeader("Accept", AsdcClientHelper.ASDC_ACCEPT_TYPE) - .addHeader("USER_ID", userid); - return client; - - } - - public APIResponse setHttpPostResponse(RESTClient client, String jsonPayload) throws Exception { - return client.httpPost(jsonPayload); - - } - - - public JSONObject enhanceJsonResponse(JSONObject asdcResponseJsonObj, int statusCode) { - - if (statusCode == 202) { // Accepted - asdcResponseJsonObj.put("statusCode", Integer.toString(statusCode)); - asdcResponseJsonObj.put("messageId", ""); - asdcResponseJsonObj.put("message", "Success"); - - } else { // error - String message = "Undefined Error Message!"; - String messageId = ""; - if (asdcResponseJsonObj.has("requestError") ) { - JSONObject requestErrorObj = asdcResponseJsonObj.getJSONObject("requestError"); - if (asdcResponseJsonObj.getJSONObject("requestError").has("serviceException") ) { - message = requestErrorObj.getJSONObject("serviceException").getString("text"); - messageId = requestErrorObj.getJSONObject("serviceException").getString("messageId"); - } - if (asdcResponseJsonObj.getJSONObject("requestError").has("policyException") ) { - message = requestErrorObj.getJSONObject("policyException").getString("text"); - messageId = requestErrorObj.getJSONObject("policyException").getString("messageId"); - } - - } - asdcResponseJsonObj.put("statusCode", Integer.toString(statusCode)); - asdcResponseJsonObj.put("messageId", messageId); - asdcResponseJsonObj.put("message", message); - } - - return asdcResponseJsonObj; - - } - - /** - * Build Uri - * @return String uri - */ - public String buildUriBuilder(String serviceModelVersionId, String operationalEnvironmentId) { - String path = serviceModelVersionId + "/distribution/" + operationalEnvironmentId +"/activate"; - UriBuilder uriBuilder = UriBuilder.fromPath(asdcEndpoint + AsdcClientHelper.PARTIAL_ASDC_URI) - .path(path); - return uriBuilder.build().toString(); - } - - /** - * Build JSON context - * @return String json - */ - public String buildJsonWorkloadContext(String workloadContext) { - return new JSONObject().put("workloadContext", workloadContext).toString(); - - } - - /** - * get asdc instanceId of this object - */ - public String getAsdcInstanceId() { - return this.instanceid; - } - - /** - * get asdc asdcEndpoint of this object - */ - public String getAsdcEndpoint() { - return this.asdcEndpoint; - } - - /** - * get asdc asdcUserId of this object - */ - public String getAsdcUserId() { - return this.userid; - } - - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java deleted file mode 100644 index 1bfe979f4f..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java +++ /dev/null @@ -1,286 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.process; - -import java.io.IOException; -import java.util.List; - -import org.json.JSONObject; -import org.openecomp.mso.apihandlerinfra.MsoPropertiesUtils; -import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; -import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.AsdcClientCallFailed; -import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.TenantIsolationException; -import org.openecomp.mso.apihandlerinfra.tenantisolation.helpers.AsdcClientHelper; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.ServiceModelList; -import org.openecomp.mso.client.aai.entities.AAIResultWrapper; -import org.openecomp.mso.client.aai.objects.AAIOperationalEnvironment; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.requestsdb.OperationalEnvDistributionStatus; -import org.openecomp.mso.requestsdb.OperationalEnvDistributionStatusDb; -import org.openecomp.mso.requestsdb.OperationalEnvServiceModelStatus; -import org.openecomp.mso.requestsdb.OperationalEnvServiceModelStatusDb; -import org.openecomp.mso.requestsdb.RequestsDBHelper; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; - - -public class ActivateVnfOperationalEnvironment extends OperationalEnvironmentProcess { - - private static final String SERVICE_NAME = "ActivateVnfOperationalEnvironment"; - private AsdcClientHelper asdcClientHelper = null; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - private String className = this.getClass().getSimpleName(); - private String methodName = ""; - private String classMethodMessage = ""; - private String errorMessage = ""; - - private String operationalEnvironmentId = ""; - private int DEFAULT_ACTIVATE_RETRY_COUNT = 3; - private boolean successIndicator = false; - - MsoJavaProperties properties; - OperationalEnvDistributionStatusDb activateDistributionDb = null; - OperationalEnvDistributionStatus queryDistributionDbResponse = null; - OperationalEnvServiceModelStatusDb activateServiceModelDb = null; - OperationalEnvServiceModelStatus queryServiceModelResponse = null; - - /** - * The class constructor with loadProperties() - * @param CloudOrchestrationRequest - object - * @param requestId - string - */ - public ActivateVnfOperationalEnvironment(CloudOrchestrationRequest request, String requestId) { - super(request, requestId); - MsoLogger.setServiceName (getRequestId()); - MsoLogger.setLogContext(getRequestId(), getRequest().getOperationalEnvironmentId()); - this.properties = MsoPropertiesUtils.loadMsoProperties(); - asdcClientHelper = new AsdcClientHelper(properties); - } - - @Override - protected String getServiceName() { - return ActivateVnfOperationalEnvironment.SERVICE_NAME; - } - - /** - * The Point-Of-Entry from APIH with VID request to send activate request - * @return void - nothing - */ - @Override - public void execute() { - - methodName = "execute() method. "; - classMethodMessage = className + " " + methodName; - msoLogger.debug("Begin of " + classMethodMessage); - - activateDistributionDb = getOperationalEnvDistributionStatusDb(); - activateServiceModelDb = getOperationalEnvServiceModelStatusDb(); - - try { - - msoLogger.debug("Start of extracting variables from Input."); - msoLogger.debug(" requestId: " + requestId); - msoLogger.debug(" cloudOrchestrationRequest: " + request.toString()); - String operationalEnvironmentId = request.getOperationalEnvironmentId(); - this.operationalEnvironmentId = operationalEnvironmentId; - msoLogger.debug(" operationalEnvironmentId: " + this.operationalEnvironmentId); - String vidWorkloadContext = request.getRequestDetails().getRequestParameters().getWorkloadContext(); - List serviceModelVersionIdList = request.getRequestDetails().getRequestParameters().getManifest().getServiceModelList(); - msoLogger.debug(" serviceModelVersionIdList size(): " + serviceModelVersionIdList.size()); - msoLogger.debug("End of extracting variables from Input."); - - msoLogger.debug("Start of getting AAIOperationalEnvironment Object."); - AAIOperationalEnvironment operationalEnv = getAAIOperationalEnvironment(operationalEnvironmentId); - String workloadContext = operationalEnv.getWorkloadContext(); - msoLogger.debug(" aai workloadContext: " + workloadContext); - if (vidWorkloadContext.equals(workloadContext)) { - msoLogger.debug(" vid workloadContext matched with aai record, continue!"); - } else { - errorMessage = " The vid workloadContext did not match from aai record. " + " vid workloadContext:" + vidWorkloadContext + " aai workloadContext:" + workloadContext; - msoLogger.debug(errorMessage); - throw new TenantIsolationException(errorMessage); - } - msoLogger.debug("End of getting AAIOperationalEnvironment Object."); - - msoLogger.debug("Start of sending activation request to ASDC."); - processActivateASDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext); - msoLogger.debug("End of sending activation request to ASDC."); - - msoLogger.debug("** OVERALL status of flow: Processed ALL " + serviceModelVersionIdList.size() + " activation requests are SUCCESSFUL!"); - successIndicator = true; - msoLogger.debug("End of " + classMethodMessage); - - } catch (Exception ex) { - errorMessage = "** OVERALL status of flow: " + methodName + ex.getMessage(); - msoLogger.debug(errorMessage); - getRequestDb().updateInfraFailureCompletion(errorMessage, requestId, operationalEnvironmentId); - - } - - } - - - /** - * The Method to send the Activation Requests to ASDC - * @param requestId - string - * @param operationalEnvironmentId - string - * @param List serviceModelVersionIdList - list - * @param workloadContext - string - * @return void - nothing - */ - public void processActivateASDCRequest(String requestId, String operationalEnvironmentId, - List serviceModelVersionIdList, String workloadContext) throws TenantIsolationException, AsdcClientCallFailed { - - int retryCount = 0; - String retryCountString = properties.getProperty("mso.tenant.isolation.retry.count", null); - try { - retryCount = Integer.parseInt(retryCountString); - msoLogger.debug(" ** Used Properties File retryCount: " + retryCount); - } catch (NumberFormatException e) { - retryCount = DEFAULT_ACTIVATE_RETRY_COUNT; - msoLogger.debug(" ** Used Default retryCount: " + retryCount + " Exception: " + e.getMessage()); - } - - msoLogger.debug(" ** serviceModelVersionIdList: " + serviceModelVersionIdList.size()); - - // loop through the serviceModelVersionId, and send request ASDC - for(ServiceModelList serviceModelList : serviceModelVersionIdList){ - String serviceModelVersionId = serviceModelList.getServiceModelVersionId(); - String recoveryAction = serviceModelList.getRecoveryAction().toString().toUpperCase(); - msoLogger.debug(" ** serviceModelVersionId: " + serviceModelVersionId + "; recoveryAction: " + recoveryAction); - // should insert 1 row - activateServiceModelDb.insertOperationalEnvServiceModelStatus(requestId, operationalEnvironmentId, serviceModelVersionId, "SENT", recoveryAction, retryCount, workloadContext); - - JSONObject jsonResponse = null; - String distributionId = ""; - try { - jsonResponse = asdcClientHelper.postActivateOperationalEnvironment(serviceModelVersionId, operationalEnvironmentId, workloadContext); - msoLogger.debug(" JSONObject jsonResponse:" + jsonResponse.toString()); - String statusCode = jsonResponse.get("statusCode").toString(); - if (statusCode.equals("202")) { - distributionId = jsonResponse.get("distributionId").toString(); - - // should insert 1 row - activateDistributionDb.insertOperationalEnvDistributionStatus(distributionId, operationalEnvironmentId, serviceModelVersionId, "SENT", requestId); - - } else { - errorMessage = " Failure calling ASDC: statusCode: " + statusCode + - "; messageId: " + jsonResponse.get("messageId") + - "; message: " + jsonResponse.get("message"); - msoLogger.debug(errorMessage); - throw new AsdcClientCallFailed(errorMessage); - - } - - } catch (Exception ex) { - errorMessage = " Encountered Exception in " + methodName + " Exception: " + ex.getMessage(); - msoLogger.debug(errorMessage); - throw new TenantIsolationException(errorMessage); - } - - } - - } - - /** - * Get AAIOperationalEnvironment object - * @param String operationalEnvironmentId - * @return object AAIOperationalEnvironment - */ - public AAIOperationalEnvironment getAAIOperationalEnvironment(String operationalEnvironmentId) { - - AAIOperationalEnvironment operationalEnv = null; - getAaiHelper(); - - try { - AAIResultWrapper aaiResult = aaiHelper.getAaiOperationalEnvironment(operationalEnvironmentId); - operationalEnv = aaiResult.asBean(AAIOperationalEnvironment.class).get(); - } catch (JsonParseException e) { - msoLogger.error(" **** JsonParseException: ", e); - } catch (JsonMappingException e) { - msoLogger.error(" **** JsonMappingException: ", e); - } catch (IOException e) { - msoLogger.error(" **** IOException: ", e); - } catch (Exception e) { - msoLogger.error(" **** Exception: ", e); - } - - return operationalEnv; - - } - - - /** - * Overall Success indicator - * @return true or false - */ - public boolean isSuccess() { - return successIndicator; - } - - /** - * Set to new OperationalEnvDistributionStatusDb - * @return void - */ - public void setOperationalEnvDistributionStatusDb (OperationalEnvDistributionStatusDb activateDistributionDb) { - this.activateDistributionDb = activateDistributionDb; - } - - /** - * Set to new OperationalEnvServiceModelStatusDb - * @return void - */ - public void setOperationalEnvServiceModelStatusDb (OperationalEnvServiceModelStatusDb activateServiceModelDb) { - this.activateServiceModelDb = activateServiceModelDb; - } - - /** - * Set to new AsdcClientHelper - * @return void - */ - public void setAsdcClientHelper (AsdcClientHelper asdcClientHelper) { - this.asdcClientHelper = asdcClientHelper; - } - - /** - * get OperationalEnvDistributionStatusDb instance - */ - public OperationalEnvDistributionStatusDb getOperationalEnvDistributionStatusDb() { - if(this.activateDistributionDb == null) { - this.activateDistributionDb = OperationalEnvDistributionStatusDb.getInstance(); - } - return this.activateDistributionDb; - } - - /** - * get OperationalEnvServiceModelStatusDb instance - */ - public OperationalEnvServiceModelStatusDb getOperationalEnvServiceModelStatusDb() { - if(this.activateServiceModelDb == null) { - this.activateServiceModelDb = OperationalEnvServiceModelStatusDb.getInstance(); - } - return this.activateServiceModelDb; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java deleted file mode 100644 index 7ef0da61f5..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java +++ /dev/null @@ -1,342 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.process; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.json.JSONObject; -import org.openecomp.mso.apihandlerinfra.MsoPropertiesUtils; -import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; -import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.AsdcClientCallFailed; -import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.TenantIsolationException; -import org.openecomp.mso.apihandlerinfra.tenantisolation.helpers.AsdcClientHelper; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Distribution; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.DistributionStatus; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.requestsdb.OperationalEnvDistributionStatus; -import org.openecomp.mso.requestsdb.OperationalEnvDistributionStatusDb; -import org.openecomp.mso.requestsdb.OperationalEnvServiceModelStatus; -import org.openecomp.mso.requestsdb.OperationalEnvServiceModelStatusDb; - - -public class ActivateVnfStatusOperationalEnvironment extends OperationalEnvironmentProcess { - - private static final String SERVICE_NAME = "ActivateVnfStatusOperationalEnvironment"; - private AsdcClientHelper asdcClientHelper = null; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - private String className = this.getClass().getSimpleName(); - private String methodName = ""; - private String classMethodMessage = ""; - private String errorMessage = ""; - - private String operationalEnvironmentId = ""; - private boolean successIndicator = false; - - MsoJavaProperties properties; - OperationalEnvDistributionStatusDb activateDistributionDb = null; - OperationalEnvDistributionStatus queryDistributionDbResponse = null; - OperationalEnvServiceModelStatusDb activateServiceModelDb = null; - OperationalEnvServiceModelStatus queryServiceModelResponse = null; - - /** - * The class constructor with loadProperties() - * @param CloudOrchestrationRequest - object - * @param requestId - string - */ - public ActivateVnfStatusOperationalEnvironment(CloudOrchestrationRequest request, String requestId) { - super(request, requestId); - MsoLogger.setServiceName (getRequestId()); - MsoLogger.setLogContext(getRequestId(), getRequest().getOperationalEnvironmentId()); - this.properties = MsoPropertiesUtils.loadMsoProperties(); - asdcClientHelper = new AsdcClientHelper(properties); - } - - @Override - protected String getServiceName() { - return ActivateVnfStatusOperationalEnvironment.SERVICE_NAME; - } - - - /** - * The Point-Of-Entry from APIH with activate status from ASDC - * @return void - nothing - */ - @Override - public void execute() { - - methodName = "execute() method. "; - classMethodMessage = className + " " + methodName; - msoLogger.debug("Begin of " + classMethodMessage); - - activateDistributionDb = getOperationalEnvDistributionStatusDb(); - activateServiceModelDb = getOperationalEnvServiceModelStatusDb(); - - try { - - String asdcDistributionId = request.getDistributionId(); - Distribution distributionObject = request.getDistribution(); - msoLogger.debug(" ** asdcDistributionId: " + asdcDistributionId + ";" + " status: " + request.getDistribution().getStatus()); - - // Distribution, Query for operationalEnvironmentId, serviceModelVersionId - queryDistributionDbResponse = activateDistributionDb.getOperationalEnvDistributionStatus(asdcDistributionId); - - if(queryDistributionDbResponse == null) { - throw new TenantIsolationException("DistributionId doesn't exist in the DB: " + asdcDistributionId); - } - - String operationalEnvironmentId = queryDistributionDbResponse.getOperationalEnvId(); - this.operationalEnvironmentId = operationalEnvironmentId; - String serviceModelVersionId = queryDistributionDbResponse.getServiceModelVersionId(); - - // ServiceModel, Query for dbRequestId, recoveryAction, retryCountString - queryServiceModelResponse = activateServiceModelDb.getOperationalEnvServiceModelStatus(operationalEnvironmentId, serviceModelVersionId); - String origRequestId = queryServiceModelResponse.getRequestId(); - this.requestId = origRequestId; - - msoLogger.debug("Start of processing activation status."); - processActivateASDCStatus(asdcDistributionId, distributionObject); - msoLogger.debug("End of processing activation status."); - - // After EVERY status processed, need to query the status of all service modelId - // to determine the OVERALL status if "COMPLETE" or "FAILURE": - checkOrUpdateOverallStatus(origRequestId, operationalEnvironmentId); - - msoLogger.debug("End of " + classMethodMessage); - - } catch (Exception ex) { - errorMessage = "** OVERALL status of flow: " + methodName + ex.getMessage(); - msoLogger.debug(errorMessage); - getRequestDb().updateInfraFailureCompletion(errorMessage, requestId, operationalEnvironmentId); - - } - - } - - /** - * The Method to process the Activation Status from ASDC - * @param asdcDistributionId - string - * @param Distribution - object - * @return void - nothing - */ - public void processActivateASDCStatus(String asdcDistributionId, Distribution asdcStatus) throws TenantIsolationException { - - String operationalEnvironmentId = queryDistributionDbResponse.getOperationalEnvId(); - String serviceModelVersionId = queryDistributionDbResponse.getServiceModelVersionId(); - - String origRequestId = queryServiceModelResponse.getRequestId(); - String recoveryAction = queryServiceModelResponse.getRecoveryAction(); - int retryCount = queryServiceModelResponse.getRetryCount(); - String workloadContext = queryServiceModelResponse.getWorkloadContext(); - - // Validate/process status - if (asdcStatus.getStatus().toString().equals(DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString())) { - // should update 1 row, update status to "DISTRIBUTION_COMPLETE_OK" - activateDistributionDb.updateOperationalEnvDistributionStatus(asdcStatus.getStatus().toString(), asdcDistributionId, operationalEnvironmentId, serviceModelVersionId); - // should update 1 row, update status and retryCount = 0 (ie, serviceModelVersionId is DONE!) - activateServiceModelDb.updateOperationalEnvRetryCountStatus(operationalEnvironmentId, serviceModelVersionId, asdcStatus.getStatus().toString(), 0); - - } else { - - // "DISTRIBUTION_COMPLETE_ERROR", Check if recoveryAction is "RETRY" - if (recoveryAction.equals("RETRY") & retryCount > 0) { - // RESEND / RETRY serviceModelVersionId to ASDC - JSONObject jsonResponse = null; - String newDistributionId = ""; - try { - jsonResponse = asdcClientHelper.postActivateOperationalEnvironment(serviceModelVersionId, operationalEnvironmentId, workloadContext); - String statusCode = jsonResponse.get("statusCode").toString(); - if (statusCode.equals("202")) { - newDistributionId = jsonResponse.get("distributionId").toString(); - - // should insert 1 row, NEW distributionId for old serviceModelServiceId - activateDistributionDb.insertOperationalEnvDistributionStatus(newDistributionId, operationalEnvironmentId, serviceModelVersionId, "SENT", origRequestId); - - // update retryCount (less 1) for the serviceModelServiceId - retryCount = retryCount - 1; - // should update 1 row, original insert - activateServiceModelDb.updateOperationalEnvRetryCountStatusPerReqId(operationalEnvironmentId, serviceModelVersionId, asdcStatus.getStatus().toString(), retryCount, origRequestId); - - // should update 1 row, OLD distributionId set to status error (ie, old distributionId is DONE!). - activateDistributionDb.updateOperationalEnvDistributionStatus(DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString(), asdcDistributionId, operationalEnvironmentId, serviceModelVersionId); - - } else { - errorMessage = " Failure calling ASDC: statusCode: " + statusCode + - "; messageId: " + jsonResponse.get("messageId") + - "; message: " + jsonResponse.get("message"); - msoLogger.debug(errorMessage); - throw new AsdcClientCallFailed(errorMessage); - - } - - } catch (Exception ex) { - errorMessage = " Encountered Exception in " + methodName + " Exception: " + ex.getMessage(); - msoLogger.debug(errorMessage); - throw new TenantIsolationException(errorMessage); - } - - - } else { // either RETRY & Count = 0, or 'ABORT', or 'SKIP' - - if (recoveryAction.equals("SKIP") || recoveryAction.equals("ABORT")) { - String modifiedStatus = ""; - if (recoveryAction.equals("SKIP")) { // considered SUCCESS - modifiedStatus = DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString(); - } else { - if (recoveryAction.equals("ABORT")) { - modifiedStatus = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString(); // ABORT, error - } - } - // should update 1 row, modified status & retryCount set 0 - activateServiceModelDb.updateOperationalEnvRetryCountStatus(operationalEnvironmentId, serviceModelVersionId, modifiedStatus, 0); - // should update 1 row, modified status - activateDistributionDb.updateOperationalEnvDistributionStatus(modifiedStatus, asdcDistributionId, operationalEnvironmentId, serviceModelVersionId); - - } else { - // RETRY & Count = 0 (do nothing!) - } - } - - } - - } - - /** - * The Method to check the overall status of the Activation for an operationalEnvironmentId - * @param origRequestId - string - * @param operationalEnvironmentId - string - * @return void - nothing - * @throws Exception - */ - public void checkOrUpdateOverallStatus(String origRequestId, String operationalEnvironmentId) throws Exception { - - List queryServiceModelResponseList = activateServiceModelDb.getOperationalEnvIdStatus(operationalEnvironmentId, origRequestId); - msoLogger.debug(" **** queryServiceModelResponseList.size(): " + queryServiceModelResponseList.size()); - - String status = "Waiting"; - int count = 0; - // loop through the statuses of the service model - for (OperationalEnvServiceModelStatus queryServiceModelResponse : queryServiceModelResponseList) { - status = queryServiceModelResponse.getServiceModelVersionDistrStatus(); - // all should be OK to be completed. - if ((status.equals(DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString()) && - (queryServiceModelResponse.getRetryCount() == 0))) { - status = "Completed"; - count ++; - } - // one error with zero retry, means all are failures. - if ((status.equals(DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString()) && - (queryServiceModelResponse.getRetryCount() == 0))) { - status = "Failure"; - count = queryServiceModelResponseList.size(); - break; - } - - } - - // "DISTRIBUTION_COMPLETE_OK" : Completed / Successful - if (status == "Completed" && queryServiceModelResponseList.size() == count) { - executeAAIPatch(operationalEnvironmentId); - String messageStatus = "Overall Activation process is complete. " + status; - successIndicator = true; - msoLogger.debug(messageStatus); - // Update DB to COMPLETION - getRequestDb().updateInfraSuccessCompletion(messageStatus, origRequestId, operationalEnvironmentId); - } else { - // "DISTRIBUTION_COMPLETE_ERROR" : Failure - if (status == "Failure" && queryServiceModelResponseList.size() == count) { - errorMessage = "Overall Activation process is a Failure. " + status; - msoLogger.debug(errorMessage); - getRequestDb().updateInfraFailureCompletion(errorMessage, requestId, operationalEnvironmentId); - } else { - msoLogger.debug(" **** Still waiting for more distribution status!"); // 1+ rows - } - } - - } - - private void executeAAIPatch(String operationalEnvironmentId) throws Exception { - msoLogger.debug("Start of AA&I UPDATE client call in ActivateVnfStatusOperationalEnvironment"); - - Map payload = new HashMap<>(); - payload.put("operational-environment-status", "ACTIVE"); - getAaiHelper().updateAaiOperationalEnvironment(operationalEnvironmentId, payload); - - msoLogger.debug("End of AA&I UPDATE client call in ActivateVnfStatusOperationalEnvironment"); - } - - /** - * Overall Success indicator - * @return true or false - */ - public boolean isSuccess() { - return successIndicator; - } - - /** - * Set to new OperationalEnvDistributionStatusDb - * @return void - */ - public void setOperationalEnvDistributionStatusDb (OperationalEnvDistributionStatusDb activateDistributionDb) { - this.activateDistributionDb = activateDistributionDb; - } - - /** - * Set to new OperationalEnvServiceModelStatusDb - * @return void - */ - public void setOperationalEnvServiceModelStatusDb (OperationalEnvServiceModelStatusDb activateServiceModelDb) { - this.activateServiceModelDb = activateServiceModelDb; - } - - - /** - * Set to new AsdcClientHelper - * @return void - */ - public void setAsdcClientHelper (AsdcClientHelper asdcClientHelper) { - this.asdcClientHelper = asdcClientHelper; - } - - /** - * get OperationalEnvDistributionStatusDb instance - */ - public OperationalEnvDistributionStatusDb getOperationalEnvDistributionStatusDb() { - if(this.activateDistributionDb == null) { - this.activateDistributionDb = OperationalEnvDistributionStatusDb.getInstance(); - } - return this.activateDistributionDb; - } - - /** - * get OperationalEnvServiceModelStatusDb instance - */ - public OperationalEnvServiceModelStatusDb getOperationalEnvServiceModelStatusDb() { - if(this.activateServiceModelDb == null) { - this.activateServiceModelDb = OperationalEnvServiceModelStatusDb.getInstance(); - } - return this.activateServiceModelDb; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java deleted file mode 100644 index 3dd1b72ca6..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.process; - -import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; -import org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap.DmaapOperationalEnvClient; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - - -public class CreateEcompOperationalEnvironment extends OperationalEnvironmentProcess { - - private static final String SERVICE_NAME = "CreateEcompOperationalEnvironment"; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - - - public CreateEcompOperationalEnvironment(CloudOrchestrationRequest request, String requestId) { - super(request, requestId); - MsoLogger.setServiceName (getRequestId()); - MsoLogger.setLogContext(getRequestId(), getRequest().getOperationalEnvironmentId()); - } - - - protected DmaapOperationalEnvClient getDmaapClient() { - return new DmaapOperationalEnvClient(); - } - - - @Override - public void execute() { - try { - msoLogger.debug("Begin of execute method in " + SERVICE_NAME); - msoLogger.debug("CloudOrchestrationRequest: " + request.toString()); - - //Create ECOMP Managing Environment object in A&AI - getAaiHelper().createOperationalEnvironment(getAaiClientObjectBuilder().buildAAIOperationalEnvironment("ACTIVE")); - msoLogger.debug("ECOMP operational environment created in A&AI."); - - // Call client to publish to DMaap - getDmaapClient().dmaapPublishOperationalEnvRequest(getRequest().getOperationalEnvironmentId(), - getRequest().getRequestDetails().getRequestInfo().getInstanceName(), - getRequest().getRequestDetails().getRequestParameters().getOperationalEnvironmentType().toString(), - getRequest().getRequestDetails().getRequestParameters().getTenantContext(), - getRequest().getRequestDetails().getRequestParameters().getWorkloadContext(), - "Create"); - msoLogger.debug("ECOMP operational environment published in Dmaap/ASDC."); - - //Update request database - getRequestDb().updateInfraSuccessCompletion("SUCCESSFULLY Created ECOMP OperationalEnvironment.", getRequestId(), getRequest().getOperationalEnvironmentId()); - } - catch (Exception e) { - msoLogger.error("exception while publishing operational environment", e); - msoLogger.error(MessageEnum.APIH_GENERAL_EXCEPTION, "", "", "", MsoLogger.ErrorCode.UnknownError, e.getMessage()); - getRequestDb().updateInfraFailureCompletion(e.getMessage(), getRequestId(), getRequest().getOperationalEnvironmentId()); - } - } - - - @Override - protected String getServiceName() { - return CreateEcompOperationalEnvironment.SERVICE_NAME; - } - -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java deleted file mode 100644 index a235526887..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java +++ /dev/null @@ -1,216 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.process; - -import java.util.ArrayList; -import java.util.List; - -import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; -import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.TenantIsolationException; -import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RelatedInstanceList; -import org.openecomp.mso.client.aai.entities.AAIResultWrapper; -import org.openecomp.mso.client.aai.objects.AAIOperationalEnvironment; -import org.openecomp.mso.client.grm.GRMClient; -import org.openecomp.mso.client.grm.beans.OperationalInfo; -import org.openecomp.mso.client.grm.beans.Property; -import org.openecomp.mso.client.grm.beans.ServiceEndPoint; -import org.openecomp.mso.client.grm.beans.ServiceEndPointList; -import org.openecomp.mso.client.grm.beans.ServiceEndPointRequest; -import org.openecomp.mso.client.grm.beans.Version; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public class CreateVnfOperationalEnvironment extends OperationalEnvironmentProcess { - - private static final String SERVICE_NAME = "CreateVnfOperationalEnvironment"; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - private ObjectMapper mapper = new ObjectMapper(); - private GRMClient grmClient; - - public CreateVnfOperationalEnvironment(CloudOrchestrationRequest request, String requestId) { - super(request, requestId); - MsoLogger.setServiceName (getRequestId()); - MsoLogger.setLogContext(getRequestId(), getRequest().getOperationalEnvironmentId()); - } - - - @Override - public void execute() { - try { - msoLogger.debug("Begin of execute method in " + SERVICE_NAME); - //Retrieve ECOMP Managing environment info in A&AI - AAIResultWrapper aaiResultWrapper = getAaiHelper().getAaiOperationalEnvironment(getEcompManagingEnvironmentId()); - AAIOperationalEnvironment aaiEnv = mapper.readValue(aaiResultWrapper.getJson(), AAIOperationalEnvironment.class); - - //Find ECOMP environments in GRM - msoLogger.debug(" Start of GRM findRunningServicesAsString"); - String searchKey = getSearchKey(aaiEnv); - String tenantContext = getTenantContext().toUpperCase(); - String jsonResponse = getGRMClient().findRunningServicesAsString(searchKey, 1, tenantContext); - ServiceEndPointList sel = getObjectMapper().readValue(jsonResponse, ServiceEndPointList.class); - if(sel.getServiceEndPointList().size() == 0) { - throw new TenantIsolationException("GRM did not find any matches for " + searchKey + " in " + tenantContext); - } - //Replicate end-point for VNF Operating environment in GRM - List serviceEndpointRequestList = buildEndPointRequestList(sel); - int ctr = 0; - int total = serviceEndpointRequestList.size(); - for(ServiceEndPointRequest request : serviceEndpointRequestList) { - msoLogger.debug("Creating endpoint " + ++ctr + " of " + total + ": " + request.getServiceEndPoint().getName()); - getGRMClient().addServiceEndPoint(request); - } - - //Create VNF operating in A&AI - getAaiHelper().createOperationalEnvironment(getAaiClientObjectBuilder().buildAAIOperationalEnvironment("INACTIVE")); - getAaiHelper().createRelationship(getRequest().getOperationalEnvironmentId(), getEcompManagingEnvironmentId()); - - //Update request database - getRequestDb().updateInfraSuccessCompletion("SUCCESSFULLY created VNF operational environment", getRequestId(), getRequest().getOperationalEnvironmentId()); - } - catch(Exception e) { - msoLogger.error(MessageEnum.APIH_GENERAL_EXCEPTION, "", "", "", MsoLogger.ErrorCode.DataError, e.getMessage()); - getRequestDb().updateInfraFailureCompletion(e.getMessage(), requestId, getRequest().getOperationalEnvironmentId()); - } - } - - - protected String getEcompManagingEnvironmentId() throws TenantIsolationException { - RelatedInstanceList[] relatedInstances = getRequest().getRequestDetails().getRelatedInstanceList(); - if (relatedInstances.length > 0 && relatedInstances[0].getRelatedInstance() != null) { - return relatedInstances[0].getRelatedInstance().getInstanceId(); - } else { - throw new TenantIsolationException("Unable to get Managing ECOMP Environment ID, request related instance list is empty!"); - } - } - - - protected String getTenantContext() throws TenantIsolationException { - if(!StringUtils.isEmpty(getRequest().getRequestDetails().getRequestParameters().getTenantContext())) { - return getRequest().getRequestDetails().getRequestParameters().getTenantContext(); - } - else { - throw new TenantIsolationException("Tenant Context is missing from request!"); - } - } - - - private List buildEndPointRequestList(ServiceEndPointList serviceEndPointList) throws TenantIsolationException { - List endpointList = serviceEndPointList.getServiceEndPointList(); - msoLogger.debug("Number of service endpoints from GRM: " + endpointList.size()); - List serviceEndPointRequestList = new ArrayList(); - for(ServiceEndPoint serviceEndpoint : endpointList) { - serviceEndPointRequestList.add(buildServiceEndpoint(serviceEndpoint)); - } - return serviceEndPointRequestList; - } - - - private ServiceEndPointRequest buildServiceEndpoint(ServiceEndPoint serviceEndpoint) throws TenantIsolationException { - - //@TODO: handle nulls? Put in a ServiceEndpointWrapper class which will check for nulls and flatten access to fields - Version ver = new Version(); - ver.setMajor(serviceEndpoint.getVersion().getMajor()); - ver.setMinor(serviceEndpoint.getVersion().getMinor()); - ver.setPatch(serviceEndpoint.getVersion().getPatch()); - - ServiceEndPoint endpoint = new ServiceEndPoint(); - endpoint.setName(buildServiceNameForVnf(serviceEndpoint.getName())); - - endpoint.setVersion(ver); - endpoint.setHostAddress(serviceEndpoint.getHostAddress()); - endpoint.setListenPort(serviceEndpoint.getListenPort()); - endpoint.setLatitude(serviceEndpoint.getLatitude()); - endpoint.setLongitude(serviceEndpoint.getLongitude()); - endpoint.setContextPath(serviceEndpoint.getContextPath()); - endpoint.setRouteOffer(serviceEndpoint.getRouteOffer()); - - OperationalInfo operInfo = new OperationalInfo(); - operInfo.setCreatedBy(serviceEndpoint.getOperationalInfo().getCreatedBy()); - operInfo.setUpdatedBy(serviceEndpoint.getOperationalInfo().getUpdatedBy()); - - endpoint.setOperationalInfo(operInfo); - endpoint.setProperties(serviceEndpoint.getProperties()); - - String env = getEnvironmentName(serviceEndpoint.getProperties()); - - ServiceEndPointRequest serviceEndPontRequest = new ServiceEndPointRequest(); - serviceEndPontRequest.setEnv(env); - serviceEndPontRequest.setServiceEndPoint(endpoint); - - return serviceEndPontRequest; - } - - - protected String getEnvironmentName(List props) { - String env = ""; - for(Property prop : props) { - if(prop.getName().equalsIgnoreCase("Environment")) { - env = prop.getValue(); - } - } - return env; - } - - - protected String buildServiceNameForVnf(String fqName) throws TenantIsolationException { - // Service name format is: {tenantContext}.{workloadContext}.{serviceName} e.g. TEST.ECOMP_PSL.Inventory - // We need to extract the serviceName, in the above example: "Inventory" - String[] tokens = fqName.split("[.]"); - String serviceName; - if(tokens.length > 0) { - serviceName = tokens[tokens.length-1]; - } - else { - throw new TenantIsolationException("Fully qualified service name is null."); - } - String tenantContext = getRequest().getRequestDetails().getRequestParameters().getTenantContext(); - String workloadContext = getRequest().getRequestDetails().getRequestParameters().getWorkloadContext(); - return tenantContext + "." + workloadContext + "." + serviceName; - } - - - protected GRMClient getGRMClient() { - if(this.grmClient == null) { - this.grmClient = new GRMClient(); - } - return this.grmClient; - } - - - protected String getSearchKey(AAIOperationalEnvironment aaiEnv) { - return aaiEnv.getTenantContext() + "." + aaiEnv.getWorkloadContext() + ".*"; - } - - protected ObjectMapper getObjectMapper() { - return mapper; - } - - - @Override - protected String getServiceName() { - return CreateVnfOperationalEnvironment.SERVICE_NAME; - } - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java deleted file mode 100644 index b419a0ccd0..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.process; - -import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; -import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.TenantIsolationException; -import org.openecomp.mso.client.aai.entities.AAIResultWrapper; -import org.openecomp.mso.client.aai.objects.AAIOperationalEnvironment; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -public class DeactivateVnfOperationalEnvironment extends OperationalEnvironmentProcess { - - private static final String SERVICE_NAME = "DeactivateVnfOperationalEnvironment"; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - private String className = this.getClass().getName(); - - public DeactivateVnfOperationalEnvironment(CloudOrchestrationRequest request, String requestId) { - super(request, requestId); - MsoLogger.setServiceName (getRequestId()); - MsoLogger.setLogContext(getRequestId(), getRequest().getOperationalEnvironmentId()); - } - - @Override - public void execute() { - String methodName = "deactivateOperationalEnvironment() method."; - String classMethodMessage = className + " " + methodName; - - msoLogger.debug("Begin of execute method in " + SERVICE_NAME); - - String operationalEnvironmentId = getRequest().getOperationalEnvironmentId(); - msoLogger.debug("Deactivate OperationalEnvironment on " + operationalEnvironmentId); - try { - msoLogger.debug("Start of AA&I Get client call in " + classMethodMessage); - - AAIResultWrapper aaiResult = getAaiHelper().getAaiOperationalEnvironment(operationalEnvironmentId); - AAIOperationalEnvironment aaiOpEnv = aaiResult.asBean(AAIOperationalEnvironment.class).get(); - String operationalEnvironmentStatus = aaiOpEnv.getOperationalEnvironmentStatus(); - - msoLogger.debug("OperationalEnvironmentStatus is :" + operationalEnvironmentStatus); - msoLogger.debug(" End of AA&I Get client call in " + classMethodMessage); - - if(operationalEnvironmentStatus == null) { - String error = "OperationalEnvironmentStatus is null on OperationalEnvironmentId: " + operationalEnvironmentId; - throw new TenantIsolationException(error); - } - - if(operationalEnvironmentStatus.equalsIgnoreCase("ACTIVE")) { - msoLogger.debug("Start of AA&I UPDATE client call in " + classMethodMessage); - - aaiOpEnv.setOperationalEnvironmentStatus("INACTIVE"); - getAaiHelper().updateAaiOperationalEnvironment(operationalEnvironmentId, aaiOpEnv); - - msoLogger.debug(" End of AA&I UPDATE client call in " + classMethodMessage); - } else if(!operationalEnvironmentStatus.equalsIgnoreCase("INACTIVE")) { - String error = "Invalid OperationalEnvironmentStatus on OperationalEnvironmentId: " + operationalEnvironmentId; - throw new TenantIsolationException(error); - } - - getRequestDb().updateInfraSuccessCompletion("SUCCESSFULLY Deactivated OperationalEnvironment", requestId, operationalEnvironmentId); - - } catch(Exception e) { - msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, "", "", "", MsoLogger.ErrorCode.DataError, e.getMessage()); - getRequestDb().updateInfraFailureCompletion(e.getMessage(), requestId, operationalEnvironmentId); - } - - msoLogger.debug("End of " + classMethodMessage); - } - - @Override - protected String getServiceName() { - return DeactivateVnfOperationalEnvironment.SERVICE_NAME; - } -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/OperationalEnvironmentProcess.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/OperationalEnvironmentProcess.java deleted file mode 100644 index 9c2d443215..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/OperationalEnvironmentProcess.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolation.process; - -import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; -import org.openecomp.mso.apihandlerinfra.tenantisolation.helpers.AAIClientHelper; -import org.openecomp.mso.apihandlerinfra.tenantisolation.helpers.AAIClientObjectBuilder; -import org.openecomp.mso.requestsdb.RequestsDBHelper; - -public abstract class OperationalEnvironmentProcess { - - protected String requestId; - protected CloudOrchestrationRequest request; - protected AAIClientObjectBuilder aaiClientObjectBuilder; - protected AAIClientHelper aaiHelper; - protected RequestsDBHelper requestDb; - - public OperationalEnvironmentProcess(CloudOrchestrationRequest request, String requestId) { - this.requestId = requestId; - this.request = request; - this.aaiClientObjectBuilder = new AAIClientObjectBuilder(getRequest()); - } - - protected String getRequestId() { - return this.requestId; - } - - protected CloudOrchestrationRequest getRequest() { - return this.request; - } - - protected AAIClientHelper getAaiHelper() { - if(this.aaiHelper == null) { - this.aaiHelper = new AAIClientHelper(getServiceName(), getRequestId()); - } - return this.aaiHelper; - } - - protected void setAaiHelper(AAIClientHelper helper) { - this.aaiHelper = helper; - } - - protected AAIClientObjectBuilder getAaiClientObjectBuilder() { - return this.aaiClientObjectBuilder; - } - - protected RequestsDBHelper getRequestDb() { - if(requestDb == null) { - requestDb = new RequestsDBHelper(); - } - return requestDb; - } - - protected void setRequestsDBHelper(RequestsDBHelper helper) { - this.requestDb = helper; - } - - protected abstract String getServiceName(); - public abstract void execute(); -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Action.java deleted file mode 100644 index 381fed4661..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Action.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -public enum Action { - create, - activate, - deactivate, - distributionStatus -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationRequestList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationRequestList.java deleted file mode 100644 index 586843fc4d..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationRequestList.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import java.util.List; - -public class CloudOrchestrationRequestList { - - private List requestList; - - public List getRequestList() { - return requestList; - } - - public void setRequestList(List requestList) { - this.requestList = requestList; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationResponse.java deleted file mode 100644 index 8c8d4011a3..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationResponse.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -@JsonInclude(Include.NON_DEFAULT) -public class CloudOrchestrationResponse { - - protected Request request; - - public Request getRequest() { - return request; - } - - public void setRequest(Request request) { - this.request = request; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Distribution.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Distribution.java deleted file mode 100644 index 99da235154..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Distribution.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -public class Distribution { - - private Status status; - private String errorReason; - - public Status getStatus() { - return status; - } - - public void setStatus(Status status) { - this.status = status; - } - - public String getErrorReason() { - return errorReason; - } - - public void setErrorReason(String errorReason) { - this.errorReason = errorReason; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/DistributionStatus.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/DistributionStatus.java deleted file mode 100644 index fbf6db0582..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/DistributionStatus.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -public enum DistributionStatus { - DISTRIBUTION_COMPLETE_OK, - DISTRIBUTION_COMPLETE_ERROR -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/InstanceReferences.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/InstanceReferences.java deleted file mode 100644 index 481e5dac2e..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/InstanceReferences.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName(value = "instanceReferences") -@JsonInclude(Include.NON_DEFAULT) -public class InstanceReferences { - - private String operationalEnvironmentId; - private String operationalEnvName; - private String requestorId; - - public String getOperationalEnvironmentId() { - return operationalEnvironmentId; - } - - public void setOperationalEnvironmentId(String operationalEnvironmentId) { - this.operationalEnvironmentId = operationalEnvironmentId; - } - - public String getOperationalEnvName() { - return operationalEnvName; - } - - public void setOperationalEnvName(String operationalEnvName) { - this.operationalEnvName = operationalEnvName; - } - - public String getRequestorId() { - return requestorId; - } - - public void setRequestorId(String requestorId) { - this.requestorId = requestorId; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Manifest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Manifest.java deleted file mode 100644 index 1805672101..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Manifest.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName(value = "manifest") -@JsonInclude(Include.NON_DEFAULT) -public class Manifest implements Serializable { - - private static final long serialVersionUID = -3460949513229380541L; - @JsonProperty("serviceModelList") - private List serviceModelList = new ArrayList(); - - public List getServiceModelList() { - return serviceModelList; - } - - public void setServiceModelList(List serviceModelList) { - this.serviceModelList = serviceModelList; - } - - @Override - public String toString() { - return "Manifest [serviceModelList=" + serviceModelList.toString() + "]"; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java deleted file mode 100644 index 8a377132e4..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -public enum OperationalEnvironment { - - ECOMP, - VNF -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RecoveryAction.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RecoveryAction.java deleted file mode 100644 index 5d0fca542a..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RecoveryAction.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -public enum RecoveryAction { - - retry, - abort, - skip -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstance.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstance.java deleted file mode 100644 index 34d879053e..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstance.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName(value = "relatedInstance") -@JsonInclude(Include.NON_DEFAULT) -public class RelatedInstance implements Serializable { - - private static final long serialVersionUID = -6775477105573153067L; - @JsonProperty("instanceName") - protected String instanceName; - @JsonProperty("instanceId") - protected String instanceId; - @JsonProperty("resourceType") - protected ResourceType resourceType; - - public String getInstanceName() { - return instanceName; - } - public void setInstanceName(String instanceName) { - this.instanceName = instanceName; - } - public String getInstanceId() { - return instanceId; - } - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - public ResourceType getResourceType() { - return resourceType; - } - public void setResourceType(ResourceType resourceType) { - this.resourceType = resourceType; - } - - @Override - public String toString() { - return "RelatedInstance [instanceName=" + instanceName + - ", instanceId=" + instanceId + - ", resourceType=" + resourceType + "]"; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstanceList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstanceList.java deleted file mode 100644 index a9eee24b50..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstanceList.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName(value = "relatedInstanceList") -@JsonInclude(Include.NON_DEFAULT) -public class RelatedInstanceList implements Serializable { - - private static final long serialVersionUID = 1758713583807257102L; - @JsonProperty("relatedInstance") - protected RelatedInstance relatedInstance; - - public RelatedInstance getRelatedInstance() { - return relatedInstance; - } - - public void setRelatedInstance(RelatedInstance relatedInstance) { - this.relatedInstance = relatedInstance; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Request.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Request.java deleted file mode 100644 index 364080d8aa..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Request.java +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonRootName; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - - -@JsonRootName(value = "request") -@JsonInclude(Include.NON_DEFAULT) -public class Request { - - protected String requestId; - protected String startTime; - protected InstanceReferences instanceReferences; - protected String requestScope; - protected String requestType; - protected RequestDetails requestDetails; - protected RequestStatus requestStatus; - - - public String getRequestId() { - return requestId; - } - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public String getStartTime() { - return startTime; - } - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - public String getRequestScope() { - return requestScope; - } - public void setRequestScope(String requestScope) { - this.requestScope = requestScope; - } - - public String getRequestType() { - return requestType; - } - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - public RequestStatus getRequestStatus() { - return requestStatus; - } - public void setRequestStatus(RequestStatus requestStatus) { - this.requestStatus = requestStatus; - } - - public InstanceReferences getInstanceReferences() { - return instanceReferences; - } - public void setInstanceReferences(InstanceReferences instanceReferences) { - this.instanceReferences = instanceReferences; - } - - public RequestDetails getRequestDetails() { - return requestDetails; - } - public void setRequestDetails(RequestDetails requestDetails) { - this.requestDetails = requestDetails; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestDetails.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestDetails.java deleted file mode 100644 index 3faa53ac63..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestDetails.java +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import java.io.Serializable; -import java.util.Arrays; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName(value = "requestDetails") -@JsonInclude(Include.NON_DEFAULT) -public class RequestDetails implements Serializable { - - private static final long serialVersionUID = -73080684945860609L; - @JsonProperty("requestInfo") - protected RequestInfo requestInfo; - @JsonProperty("relatedInstanceList") - protected RelatedInstanceList[] relatedInstanceList; - @JsonProperty("requestParameters") - protected RequestParameters requestParameters; - - /** - * Gets the value of the requestInfo property. - * - * @return - * possible object is - * {@link RequestInfo } - * - */ - public RequestInfo getRequestInfo() { - return requestInfo; - } - - /** - * Sets the value of the requestInfo property. - * - * @param value - * allowed object is - * {@link RequestInfo } - * - */ - public void setRequestInfo(RequestInfo value) { - this.requestInfo = value; - } - - /** - * Gets the value of the requestParameters property. - * - * @return - * possible object is - * {@link RequestParameters } - * - */ - public RequestParameters getRequestParameters() { - return requestParameters; - } - - /** - * Sets the value of the requestParameters property. - * - * @param value - * allowed object is - * {@link RequestParameters } - * - */ - public void setRequestParameters(RequestParameters value) { - this.requestParameters = value; - } - - public RelatedInstanceList[] getRelatedInstanceList() { - return relatedInstanceList; - } - - public void setRelatedInstanceList(RelatedInstanceList[] relatedInstanceList) { - this.relatedInstanceList = relatedInstanceList; - } - @Override - public String toString() { - return "RequestDetails [requestInfo=" + requestInfo + - ", relatedInstanceList=" + Arrays.toString(relatedInstanceList) + - ", requestParameters=" + requestParameters + "]"; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestInfo.java deleted file mode 100644 index fdb9a10845..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestInfo.java +++ /dev/null @@ -1,118 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName(value = "requestInfo") -@JsonInclude(Include.NON_DEFAULT) -public class RequestInfo implements Serializable { - - private static final long serialVersionUID = 1346372792555344857L; - @JsonProperty("resourceType") - protected ResourceType resourceType; - @JsonProperty("source") - protected String source; - @JsonProperty("instanceName") - protected String instanceName; - @JsonProperty("requestorId") - protected String requestorId; - - /** - * Gets the value of the resourceType property. - * - * @return - * possible object is - * {@link ResourceType } - * - */ - public ResourceType getResourceType() { - return resourceType; - } - - /** - * Sets the value of the source property. - * - * @param value - * allowed object is - * {@link ResourceType } - * - */ - public void setResourceType(ResourceType value) { - this.resourceType = value; - } - - - /** - * Gets the value of the source property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSource() { - return source; - } - - /** - * Sets the value of the source property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSource(String value) { - this.source = value; - } - - public String getInstanceName() { - return instanceName; - } - - public void setInstanceName(String instanceName) { - this.instanceName = instanceName; - } - - public String getRequestorId() { - return requestorId; - } - - public void setRequestorId(String requestorId) { - this.requestorId = requestorId; - } - - @Override - public String toString() { - return "RequestInfo [source=" + source - + ", instanceName=" + instanceName - + ", requestorId=" + requestorId - + ", resourceType=" + resourceType + "]"; - } - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestList.java deleted file mode 100644 index b5a1b8a9fb..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestList.java +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import java.io.Serializable; -import java.util.Arrays; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName(value = "requestDetails") -@JsonInclude(Include.NON_DEFAULT) -public class RequestList { - - - @JsonProperty("request") - protected Request request; - @JsonProperty("requestStatus") - protected RequestStatus requestStatus; - - /** - * Gets the value of the request property. - * - * @return - * possible object is - * {@link Request } - * - */ - public Request getRequest() { - return request; - } - - /** - * Sets the value of the requestInfo property. - * - * @param value - * allowed object is - * {@link Request } - * - */ - public void setRequest(Request value) { - this.request = value; - } - - /** - * Gets the value of the requestStatus property. - * - * @return - * possible object is - * {@link RequestStatus } - * - */ - public RequestStatus getRequestStatus() { - return requestStatus; - } - - - /** - * Sets the value of the requestStatus property. - * - * @param value - * allowed object is - * {@link RequestStatus } - * - */ - public void setRequestStatus(RequestStatus value) { - this.requestStatus = value; - } - - - @Override - public String toString() { - return "RequestList [request=" + request + - ", requestStatus=" + requestStatus + "]"; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestParameters.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestParameters.java deleted file mode 100644 index 8164fc5d25..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestParameters.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName(value = "requestParameters") -@JsonInclude(Include.NON_DEFAULT) -public class RequestParameters implements Serializable { - - private static final long serialVersionUID = 8530327178156183693L; - @JsonProperty("operationalEnvironmentType") - private OperationalEnvironment operationalEnvironmentType; - @JsonProperty("tenantContext") - private String tenantContext; - @JsonProperty("workloadContext") - private String workloadContext; - @JsonProperty("manifest") - private Manifest manifest; - - public OperationalEnvironment getOperationalEnvironmentType() { - return operationalEnvironmentType; - } - - public void setOperationalEnvironmentType(OperationalEnvironment operationalEnvironmentType) { - this.operationalEnvironmentType = operationalEnvironmentType; - } - - public String getTenantContext() { - return tenantContext; - } - - public void setTenantContext(String tenantContext) { - this.tenantContext = tenantContext; - } - - public String getWorkloadContext() { - return workloadContext; - } - - public void setWorkloadContext(String workloadContext) { - this.workloadContext = workloadContext; - } - - public Manifest getManifest() { - return manifest; - } - - public void setManifest(Manifest manifest) { - this.manifest = manifest; - } - - - @Override - public String toString() { - return "RequestParameters [operationalEnvironmentType=" + operationalEnvironmentType - + ", tenantContext=" + tenantContext - + ", workloadContext=" + workloadContext - + ", manifes=" + manifest +"]"; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestReferences.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestReferences.java deleted file mode 100644 index 191337cef0..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestReferences.java +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName(value = "requestReferences") -@JsonInclude(Include.NON_DEFAULT) -public class RequestReferences implements Serializable { - - private static final long serialVersionUID = 5873356773819905368L; - - @JsonProperty("requestId") - protected String requestId; - - @JsonProperty("instanceId") - String instanceId; - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - /** - * Gets the value of the instanceId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInstanceId() { - return instanceId; - } - - /** - * Sets the value of the instanceId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - @Override - public String toString() { - return "RequestReferences [requestId=" + requestId + - ", instanceId=" + instanceId + "]"; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestStatus.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestStatus.java deleted file mode 100644 index 4514b41734..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestStatus.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -@JsonRootName(value = "requestStatus") -@JsonInclude(Include.NON_DEFAULT) -public class RequestStatus implements Serializable { - - private static final long serialVersionUID = -1835437975187313144L; - @JsonProperty("requestState") - protected String requestState; - @JsonProperty("statusMessage") - protected String statusMessage; - @JsonProperty("percentProgress") - protected String percentProgress; - @JsonProperty("timeStamp") - protected String timeStamp; - - - public String getRequestState() { - return requestState; - } - public void setRequestState(String requestState) { - this.requestState = requestState; - } - public String getStatusMessage() { - return statusMessage; - } - public void setStatusMessage(String statusMessage) { - this.statusMessage = statusMessage; - } - public String getPercentProgress() { - return percentProgress; - } - public void setPercentProgress(String percentProgress) { - this.percentProgress = percentProgress; - } - public String getTimeStamp() { - return timeStamp; - } - public void setTimeStamp(String timeStamp) { - this.timeStamp = timeStamp; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ResourceType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ResourceType.java deleted file mode 100644 index aac0e18641..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ResourceType.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -public enum ResourceType { - - operationalEnvironment -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ServiceModelList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ServiceModelList.java deleted file mode 100644 index 3ef0779476..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ServiceModelList.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName(value = "serviceModelList") -@JsonInclude(Include.NON_DEFAULT) -public class ServiceModelList implements Serializable { - - private static final long serialVersionUID = 1758713583807257102L; - - @JsonProperty("serviceModelVersionId") - protected String serviceModelVersionId; - @JsonProperty("recoveryAction") - protected RecoveryAction recoveryAction; - - public String getServiceModelVersionId() { - return serviceModelVersionId; - } - public void setServiceModelVersionId(String serviceModelVersionId) { - this.serviceModelVersionId = serviceModelVersionId; - } - public RecoveryAction getRecoveryAction() { - return recoveryAction; - } - public void setRecoveryAction(RecoveryAction recoveryAction) { - this.recoveryAction = recoveryAction; - } - - @Override - public String toString() { - return "ServiceModelList [serviceModelVersionId=" + serviceModelVersionId + "," - + "recoveryAction=" + recoveryAction +"]"; - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Status.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Status.java deleted file mode 100644 index c7693f5913..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Status.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -public enum Status { - DISTRIBUTION_COMPLETE_OK, - DISTRIBUTION_COMPLETE_ERROR -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java deleted file mode 100644 index 10ba3aa9d7..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName(value = "tenantIsolationRequest") -@JsonInclude(Include.NON_DEFAULT) -public class TenantIsolationRequest implements Serializable { - - private static final long serialVersionUID = -210322298981798607L; - @JsonProperty("requestId") - protected String requestId; - @JsonProperty("startTime") - protected String startTime; - @JsonProperty("requestScope") - protected String requestScope; - @JsonProperty("requestType") - protected String requestType; - @JsonProperty("requestDetails") - protected RequestDetails requestDetails; - @JsonProperty("requestStatus") - protected RequestStatus requestStatus; - - public String getRequestId() { - return requestId; - } - public void setRequestId(String requestId) { - this.requestId = requestId; - } - public String getStartTime() { - return startTime; - } - public void setStartTime(String startTime) { - this.startTime = startTime; - } - public String getRequestScope() { - return requestScope; - } - public void setRequestScope(String requestScope) { - this.requestScope = requestScope; - } - public String getRequestType() { - return requestType; - } - public void setRequestType(String requestType) { - this.requestType = requestType; - } - public RequestStatus getRequestStatus() { - return requestStatus; - } - public void setRequestStatus(RequestStatus requestStatus) { - this.requestStatus = requestStatus; - } - - public RequestDetails getRequestDetails() { - return requestDetails; - } - public void setRequestDetails(RequestDetails requestDetails) { - this.requestDetails = requestDetails; - } - - @Override - public String toString() { - return "Request [requestId=" + requestId + - ", startTime=" + startTime + - ", requestType=" + requestType + - ", requestDetails=" + requestDetails.toString() + - ", requestStatus=" + requestStatus.toString() + "]"; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java deleted file mode 100644 index 4b1a4541e0..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName(value = "tenantIsolationResponse") -@JsonInclude(Include.NON_DEFAULT) -public class TenantIsolationResponse implements Serializable { - - private static final long serialVersionUID = 756749312745898666L; - @JsonProperty("requestId") - protected String requestId; - @JsonProperty("status") - String status; - @JsonProperty("message") - String message; - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStatus(String status) { - this.status = status; - } - - /** - * Gets the value of the message property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessage() { - return message; - } - - /** - * Sets the value of the message property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessage(String message) { - this.message = message; - } - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantSyncResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantSyncResponse.java deleted file mode 100644 index 45676c5e68..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantSyncResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - -public class TenantSyncResponse { - - private RequestReferences requestReferences; - - public RequestReferences getRequestReferences() { - return requestReferences; - } - - public void setRequestReferences(RequestReferences requestReferences) { - this.requestReferences = requestReferences; - } - -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/package-info.java deleted file mode 100644 index 92d203abdd..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/package-info.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - -package org.openecomp.mso.apihandlerinfra.tenantisolationbeans; - diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ActionType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ActionType.java deleted file mode 100644 index 2a43658a65..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ActionType.java +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - - -package org.openecomp.mso.apihandlerinfra.vnfbeans; - - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for action-type. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="action-type">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="CREATE"/>
- *     <enumeration value="SETSTATUS"/>
- *     <enumeration value="REPLACE"/>
- *     <enumeration value="UPDATE"/>
- *     <enumeration value="DELETE"/>
- *     <enumeration value="CREATE_VF_MODULE"/>
- *     <enumeration value="UPDATE_VF_MODULE"/>
- *     <enumeration value="DELETE_VF_MODULE"/>
- *     <enumeration value="NOT_PROVIDED"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "action-type") -@XmlEnum -public enum ActionType { - - CREATE, - SETSTATUS, - REPLACE, - UPDATE, - DELETE, - CREATE_VF_MODULE, - UPDATE_VF_MODULE, - DELETE_VF_MODULE, - NOT_PROVIDED; - - public String value() { - return name(); - } - - public static ActionType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ModelType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ModelType.java deleted file mode 100644 index e3830b0c13..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ModelType.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandlerinfra.vnfbeans; - -/* - * Enum for Status values returned by API Handler to Tail-F -*/ -public enum ModelType { - service, - vnf, - vfModule, - volumeGroup, - network -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java deleted file mode 100644 index e77257c596..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java +++ /dev/null @@ -1,150 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - - -package org.openecomp.mso.apihandlerinfra.vnfbeans; - - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlElementDecl; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.namespace.QName; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the org.openecomp.mso.apihandlerinfra.vnfbeans1 package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - private final static QName _VnfParams_QNAME = new QName("http://org.openecomp/mso/infra/vnf-request/v1", "vnf-params"); - private final static QName _NetworkParams_QNAME = new QName("http://org.openecomp/mso/infra/vnf-request/v1", "network-params"); - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.apihandlerinfra.vnfbeans1 - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link VnfInputs } - * - */ - public VnfInputs createVnfInputs() { - return new VnfInputs(); - } - - /** - * Create an instance of {@link RequestInfo } - * - */ - public RequestInfo createRequestInfo() { - return new RequestInfo(); - } - - /** - * Create an instance of {@link VnfOutputs } - * - */ - public VnfOutputs createVnfOutputs() { - return new VnfOutputs(); - } - - /** - * Create an instance of {@link VnfType } - * - */ - public VnfType createVnfType() { - return new VnfType(); - } - - /** - * Create an instance of {@link VnfRequest } - * - */ - public VnfRequest createVnfRequest() { - return new VnfRequest(); - } - - - /** - * Create an instance of {@link VnfTypes } - * - */ - public VnfTypes createVnfTypes() { - return new VnfTypes(); - } - - /** - * Create an instance of {@link VnfRequests } - * - */ - public VnfRequests createVnfRequests() { - return new VnfRequests(); - } - - /** - * Create an instance of {@link VfModuleModelName } - * - */ - public VfModuleModelName createVfModuleModelName() { - return new VfModuleModelName(); - } - - /** - * Create an instance of {@link VfModuleModelNames } - * - */ - public VfModuleModelNames createVfModuleModelNames() { - return new VfModuleModelNames(); - } - - - - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp/mso/infra/vnf-request/v1", name = "vnf-params") - public JAXBElement createVnfParams(Object value) { - return new JAXBElement<>(_VnfParams_QNAME, Object.class, null, value); - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java deleted file mode 100644 index b80ea85dc8..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java +++ /dev/null @@ -1,286 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - - -package org.openecomp.mso.apihandlerinfra.vnfbeans; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="request-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="action" type="{http://org.openecomp/mso/infra/vnf-request/v1}action-type"/>
- *         <element name="request-status" type="{http://org.openecomp/mso/infra/vnf-request/v1}request-status-type" minOccurs="0"/>
- *         <element name="status-message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="progress" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
- *         <element name="start-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="end-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "action", - "requestStatus", - "statusMessage", - "progress", - "startTime", - "endTime", - "source" -}) -@XmlRootElement(name = "request-info") -public class RequestInfo { - - @XmlElement(name = "request-id") - protected String requestId; - @XmlElement(required = true) - protected ActionType action; - @XmlElement(name = "request-status") - protected RequestStatusType requestStatus; - @XmlElement(name = "status-message") - protected String statusMessage; - protected Integer progress; - @XmlElement(name = "start-time") - protected String startTime; - @XmlElement(name = "end-time") - protected String endTime; - protected String source; - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - /** - * Gets the value of the action property. - * - * @return - * possible object is - * {@link ActionType } - * - */ - public ActionType getAction() { - return action; - } - - /** - * Sets the value of the action property. - * - * @param value - * allowed object is - * {@link ActionType } - * - */ - public void setAction(ActionType value) { - this.action = value; - } - - /** - * Gets the value of the requestStatus property. - * - * @return - * possible object is - * {@link RequestStatusType } - * - */ - public RequestStatusType getRequestStatus() { - return requestStatus; - } - - /** - * Sets the value of the requestStatus property. - * - * @param value - * allowed object is - * {@link RequestStatusType } - * - */ - public void setRequestStatus(RequestStatusType value) { - this.requestStatus = value; - } - - /** - * Gets the value of the statusMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStatusMessage() { - return statusMessage; - } - - /** - * Sets the value of the statusMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStatusMessage(String value) { - this.statusMessage = value; - } - - /** - * Gets the value of the progress property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public Integer getProgress() { - return progress; - } - - /** - * Sets the value of the progress property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setProgress(Integer value) { - this.progress = value; - } - - /** - * Gets the value of the startTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStartTime() { - return startTime; - } - - /** - * Sets the value of the startTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStartTime(String value) { - this.startTime = value; - } - - /** - * Gets the value of the endTime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEndTime() { - return endTime; - } - - /** - * Sets the value of the endTime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEndTime(String value) { - this.endTime = value; - } - - /** - * Gets the value of the source property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSource() { - return source; - } - - /** - * Sets the value of the source property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSource(String value) { - this.source = value; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java deleted file mode 100644 index 1e4cdddc4a..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - - -package org.openecomp.mso.apihandlerinfra.vnfbeans; - - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for request-status-type. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="request-status-type">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="COMPLETE"/>
- *     <enumeration value="FAILED"/>
- *     <enumeration value="IN_PROGRESS"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "request-status-type") -@XmlEnum -public enum RequestStatusType { - - COMPLETE, - FAILED, - IN_PROGRESS, - PENDING, - TIMEOUT, - UNLOCKED; - - public String value() { - return name(); - } - - public static RequestStatusType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelName.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelName.java deleted file mode 100644 index a18ef86b58..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelName.java +++ /dev/null @@ -1,261 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - - -package org.openecomp.mso.apihandlerinfra.vnfbeans; - - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="model-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="model-version" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="model-invariant-uuid" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="is-base" type="{http://www.w3.org/2001/XMLSchema}Boolean"/>
- *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="asdc-service-model-version" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "modelName", - "modelVersion", - "modelInvariantUuid", - "isBase", - "id", - "description", - "asdcServiceModelVersion" -}) -@XmlRootElement(name = "vf-module-model-name") -public class VfModuleModelName { - - @XmlElement(name="model-name", required = true) - protected String modelName; - @XmlElement(name="model-version", required = true) - protected String modelVersion; - @XmlElement(name="model-invariant-uuid", required = true) - protected String modelInvariantUuid; - @XmlElement(name="is-base", required = true) - protected Boolean isBase; - @XmlElement(name="id", required = true) - protected String id; - @XmlElement(name="description", required = true) - protected String description; - @XmlElement(name="asdc-service-model-version", required = true) - protected String asdcServiceModelVersion; - - /** - * Gets the value of the modelName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getModelName() { - return modelName; - } - - /** - * Sets the value of the modelName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setModelName(String value) { - this.modelName = value; - } - - /** - * Gets the value of the modelVersion property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getModelVersion() { - return modelVersion; - } - - /** - * Sets the value of the modelVersion property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setModelVersion(String value) { - this.modelVersion = value; - } - - /** - * Gets the value of the modelInvariantUuid property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getModelInvariantUuid() { - return modelInvariantUuid; - } - - /** - * Sets the value of the modelInvariantUuid property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setModelInvariantUuid(String value) { - this.modelInvariantUuid = value; - } - - /** - * Gets the value of the isBase property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean getIsBase() { - return isBase; - } - - /** - * Sets the value of the isBase property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setIsBase(Boolean value) { - this.isBase = value; - } - - /** - * Gets the value of the id property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getId() { - return id; - } - - /** - * Sets the value of the id property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setId(String value) { - this.id = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - - /** - * Gets the value of the asdcServiceModelVersion property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAsdcServiceModelVersion() { - return asdcServiceModelVersion; - } - - /** - * Sets the value of the asdcServiceModelVersion property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAsdcServiceModelVersion(String value) { - this.asdcServiceModelVersion = value; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java deleted file mode 100644 index 0a841e99a1..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - - -package org.openecomp.mso.apihandlerinfra.vnfbeans; - - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}vf-module-model-name" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "vfModuleModelName" -}) -@XmlRootElement(name = "vf-module-model-names") -public class VfModuleModelNames { - - @XmlElement(name = "vf-module-model-name") - protected List vfModuleModelName; - - /** - * Gets the value of the vfModuleModelName property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the vnfType property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getVfModuleModelName().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link VfModuleModelName } - * - * - */ - public List getVfModuleModelName() { - if (vfModuleModelName == null) { - vfModuleModelName = new ArrayList<>(); - } - return this.vfModuleModelName; - } - - public void setVfModuleModelName(List vfModuleModelName) { - this.vfModuleModelName=vfModuleModelName; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfInputs.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfInputs.java deleted file mode 100644 index 58f8a5341e..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfInputs.java +++ /dev/null @@ -1,689 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - - -package org.openecomp.mso.apihandlerinfra.vnfbeans; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="vnf-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="vf-module-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="vnf-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="vf-module-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="vnf-type" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="vf-module-model-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="asdc-service-model-version" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="service-instance-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="backout-on-failure" type="{http://www.w3.org/2001/XMLSchema}Boolean"/>
- *         <choice>
- *         	<element name="service-type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         	<element name="service-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         </choice>
- *         <choice>
- *         	<element name="aic-node-clli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *          <element name="aic-cloud-region" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         </choice>
- *         <element name="tenant-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="prov-status" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="volume-group-name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="volume-group-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="persona-model-id" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
- *         <element name="persona-model-version" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
- *         <element name="is-base-vf-module" type="{http://www.w3.org/2001/XMLSchema}Boolean"/ minOccurs="0">
- *         <element name="vnf-persona-model-id" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
- *         <element name="vnf-persona-model-version" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "vnfId", - "vfModuleId", - "vnfName", - "vfModuleName", - "vnfType", - "vfModuleModelName", - "asdcServiceModelVersion", - "serviceInstanceId", - "backoutOnFailure", - "serviceType", - "serviceId", - "aicNodeClli", - "aicCloudRegion", - "tenantId", - "provStatus", - "volumeGroupName", - "volumeGroupId", - // BEGIN - elements valid only on BPMN interface - "personaModelId", - "personaModelVersion", - "isBaseVfModule", - "vnfPersonaModelId", - "vnfPersonaModelVersion" - // END - elements valid only on BPMN interface -}) -@XmlRootElement(name = "vnf-inputs") -public class VnfInputs { - - @XmlElement(name = "vnf-id") - protected String vnfId; - @XmlElement(name = "vf-module-id") - protected String vfModuleId; - @XmlElement(name = "vnf-name") - protected String vnfName; - @XmlElement(name = "vf-module-name") - protected String vfModuleName; - @XmlElement(name = "vnf-type") - protected String vnfType; - @XmlElement(name = "vf-module-model-name") - protected String vfModuleModelName; - @XmlElement(name = "asdc-service-model-version") - protected String asdcServiceModelVersion; - @XmlElement(name = "service-instance-id") - protected String serviceInstanceId; - @XmlElement(name = "backout-on-failure") - protected Boolean backoutOnFailure; - @XmlElement(name = "service-type") - protected String serviceType; - @XmlElement(name = "service-id") - protected String serviceId; - @XmlElement(name = "aic-node-clli") - protected String aicNodeClli; - @XmlElement(name = "aic-cloud-region") - protected String aicCloudRegion; - @XmlElement(name = "tenant-id", required = true) - protected String tenantId; - @XmlElement(name = "prov-status") - protected String provStatus; - @XmlElement(name = "volume-group-name") - protected String volumeGroupName; - @XmlElement(name = "volume-group-id") - protected String volumeGroupId; - @XmlElement(name = "persona-model-id") - protected String personaModelId; - @XmlElement(name = "persona-model-version") - protected String personaModelVersion; - @XmlElement(name = "is-base-vf-module") - protected Boolean isBaseVfModule; - @XmlElement(name = "vnf-persona-model-id") - protected String vnfPersonaModelId; - @XmlElement(name = "vnf-persona-model-version") - protected String vnfPersonaModelVersion; - - /** - * Gets the value of the vnfId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVnfId() { - return vnfId; - } - - /** - * Sets the value of the vnfId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVnfId(String value) { - this.vnfId = value; - } - - /** - * Gets the value of the vnfName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVnfName() { - return vnfName; - } - - /** - * Sets the value of the vnfName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVnfName(String value) { - this.vnfName = value; - } - - /** - * Gets the value of the vnfType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVnfType() { - return vnfType; - } - - /** - * Sets the value of the vnfType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVnfType(String value) { - this.vnfType = value; - } - - /** - * Gets the value of the serviceInstanceId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getServiceInstanceId() { - return serviceInstanceId; - } - - /** - * Sets the value of the serviceInstanceId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setServiceInstanceId(String value) { - this.serviceInstanceId = value; - } - - /** - * Gets the value of the serviceType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getServiceType() { - return serviceType; - } - - /** - * Sets the value of the serviceType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setServiceType(String value) { - this.serviceType = value; - } - - /** - * Gets the value of the serviceId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getServiceId() { - return serviceId; - } - - /** - * Sets the value of the serviceId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setServiceId (String value) { - this.serviceId = value; - } - - - /** - * Gets the value of the aicNodeClli property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAicNodeClli() { - return aicNodeClli; - } - - /** - * Sets the value of the aicNodeClli property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAicNodeClli(String value) { - this.aicNodeClli = value; - } - - /** - * Gets the value of the aicCloudRegion property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAicCloudRegion() { - return aicCloudRegion; - } - - /** - * Sets the value of the aicCloudRegion property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAicCloudRegion(String value) { - this.aicCloudRegion = value; - } - - /** - * Gets the value of the tenantId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTenantId() { - return tenantId; - } - - /** - * Sets the value of the tenantId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTenantId(String value) { - this.tenantId = value; - } - - /** - * Gets the value of the provStatus property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getProvStatus() { - return provStatus; - } - - /** - * Sets the value of the provStatus property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setProvStatus(String value) { - this.provStatus = value; - } - - /** - * Gets the value of the volumeGroupName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVolumeGroupName() { - return volumeGroupName; - } - - /** - * Sets the value of the volumeGroupName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVolumeGroupName(String value) { - this.volumeGroupName = value; - } - - /** - * Gets the value of the volumeGroupId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVolumeGroupId() { - return volumeGroupId; - } - - /** - * Sets the value of the volumeGroupId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVolumeGroupId(String value) { - this.volumeGroupId = value; - } - - /** - * Gets the value of the vfModuleId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVfModuleId() { - return vfModuleId; - } - - /** - * Sets the value of the vfModuleId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVfModuleId(String value) { - this.vfModuleId = value; - } - - /** - * Gets the value of the vfModuleName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVfModuleName() { - return vfModuleName; - } - - /** - * Sets the value of the vfModuleName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVfModuleName(String value) { - this.vfModuleName = value; - } - - /** - * Gets the value of the vfModuleModelName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVfModuleModelName() { - return vfModuleModelName; - } - - /** - * Sets the value of the vfModuleModelName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVfModuleModelName(String value) { - this.vfModuleModelName = value; - } - - /** - * Gets the value of the asdcServiceModelVersion property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAsdcServiceModelVersion() { - return asdcServiceModelVersion; - } - - /** - * Sets the value of the asdcServiceModelVersion property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAsdcServiceModelVersion(String value) { - this.asdcServiceModelVersion = value; - } - - /** - * Gets the value of the backoutOnFailure property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean getBackoutOnFailure() { - return backoutOnFailure; - } - - /** - * Sets the value of the backoutOnFailure property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setBackoutOnFailure(Boolean value) { - this.backoutOnFailure = value; - } - - /** - * Gets the value of the personaModelId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPersonaModelId() { - return personaModelId; - } - - /** - * Sets the value of the personaModelId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPersonaModelId(String value) { - this.personaModelId = value; - } - - /** - * Gets the value of the personaModelVersion property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPersonaModelVersion() { - return personaModelVersion; - } - - /** - * Sets the value of the personaModelVersion property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPersonaModelVersion(String value) { - this.personaModelVersion = value; - } - - - /** - * Gets the value of the isBaseVfModule property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public Boolean getIsBaseVfModule() { - return isBaseVfModule; - } - - /** - * Sets the value of the isBaseVfModule property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setIsBaseVfModule(Boolean value) { - this.isBaseVfModule = value; - } - - /** - * Gets the value of the vnfPersonaModelId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVnfPersonaModelId() { - return vnfPersonaModelId; - } - - /** - * Sets the value of the vnfPersonaModelId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVnfPersonaModelId(String value) { - this.vnfPersonaModelId = value; - } - - /** - * Gets the value of the vnfPersonaModelVersion property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVnfPersonaModelVersion() { - return vnfPersonaModelVersion; - } - - /** - * Sets the value of the vnfPersonaModelVersion property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVnfPersonaModelVersion(String value) { - this.vnfPersonaModelVersion = value; - } - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfOutputs.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfOutputs.java deleted file mode 100644 index 3cd5474182..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfOutputs.java +++ /dev/null @@ -1,291 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - - -package org.openecomp.mso.apihandlerinfra.vnfbeans; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="vnf-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="vf-module-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="vnf-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="vf-module-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="aic-node-clli" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="tenant-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="volume-group-name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="volume-group-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "vnfId", - "vfModuleId", - "vnfName", - "vfModuleName", - "aicNodeClli", - "tenantId", - "volumeGroupName", - "volumeGroupId" -}) -@XmlRootElement(name = "vnf-outputs") -public class VnfOutputs { - - @XmlElement(name = "vnf-id", required = true) - protected String vnfId; - @XmlElement(name = "vf-module-id") - protected String vfModuleId; - @XmlElement(name = "vnf-name", required = true) - protected String vnfName; - @XmlElement(name = "vf-module-name", required = true) - protected String vfModuleName; - @XmlElement(name = "aic-node-clli", required = true) - protected String aicNodeClli; - @XmlElement(name = "tenant-id", required = true) - protected String tenantId; - @XmlElement(name = "volume-group-name") - protected String volumeGroupName; - @XmlElement(name = "volume-group-id") - protected String volumeGroupId; - - /** - * Gets the value of the vnfId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVnfId() { - return vnfId; - } - - /** - * Sets the value of the vnfId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVnfId(String value) { - this.vnfId = value; - } - - /** - * Gets the value of the vfModuleId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVfModuleId() { - return vfModuleId; - } - - /** - * Sets the value of the vfModuleId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVfModuleId(String value) { - this.vfModuleId = value; - } - - - - /** - * Gets the value of the vnfName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVnfName() { - return vnfName; - } - - /** - * Sets the value of the vnfName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVnfName(String value) { - this.vnfName = value; - } - - /** - * Gets the value of the vfModuleName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVfModuleName() { - return vfModuleName; - } - - /** - * Sets the value of the vfModuleName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVfModuleName(String value) { - this.vfModuleName = value; - } - - - /** - * Gets the value of the aicNodeClli property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAicNodeClli() { - return aicNodeClli; - } - - /** - * Sets the value of the aicNodeClli property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAicNodeClli(String value) { - this.aicNodeClli = value; - } - - /** - * Gets the value of the tenantId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTenantId() { - return tenantId; - } - - /** - * Sets the value of the tenantId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTenantId(String value) { - this.tenantId = value; - } - - /** - * Gets the value of the volumeGroupName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVolumeGroupName() { - return volumeGroupName; - } - - /** - * Sets the value of the volumeGroupName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVolumeGroupName(String value) { - this.volumeGroupName = value; - } - - /** - * Gets the value of the volumeGroupId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVolumeGroupId() { - return volumeGroupId; - } - - /** - * Sets the value of the volumeGroupId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVolumeGroupId(String value) { - this.volumeGroupId = value; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java deleted file mode 100644 index e989ad257c..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java +++ /dev/null @@ -1,179 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - - -package org.openecomp.mso.apihandlerinfra.vnfbeans; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}request-info"/>
- *           <sequence>
- *             <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}vnf-inputs"/>
- *             <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}vnf-params" minOccurs="0"/>
- *             <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}vnf-outputs" minOccurs="0"/>
- *           </sequence>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestInfo", - "vnfInputs", - "vnfParams", - "vnfOutputs" -}) -@XmlRootElement(name = "vnf-request") -public class VnfRequest { - - @XmlElement(name = "request-info", required = true) - protected RequestInfo requestInfo; - @XmlElement(name = "vnf-inputs") - protected VnfInputs vnfInputs; - @XmlElement(name = "vnf-params") - protected Object vnfParams; - @XmlElement(name = "vnf-outputs") - protected VnfOutputs vnfOutputs; - - - /** - * Gets the value of the requestInfo property. - * - * @return - * possible object is - * {@link RequestInfo } - * - */ - public RequestInfo getRequestInfo() { - return requestInfo; - } - - /** - * Sets the value of the requestInfo property. - * - * @param value - * allowed object is - * {@link RequestInfo } - * - */ - public void setRequestInfo(RequestInfo value) { - this.requestInfo = value; - } - - /** - * Gets the value of the vnfInputs property. - * - * @return - * possible object is - * {@link VnfInputs } - * - */ - public VnfInputs getVnfInputs() { - return vnfInputs; - } - - /** - * Sets the value of the vnfInputs property. - * - * @param value - * allowed object is - * {@link VnfInputs } - * - */ - public void setVnfInputs(VnfInputs value) { - this.vnfInputs = value; - } - - /** - * Gets the value of the vnfParams property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getVnfParams() { - return vnfParams; - } - - /** - * Sets the value of the vnfParams property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setVnfParams(Object value) { - this.vnfParams = value; - } - - /** - * Gets the value of the vnfOutputs property. - * - * @return - * possible object is - * {@link VnfOutputs } - * - */ - public VnfOutputs getVnfOutputs() { - return vnfOutputs; - } - - /** - * Sets the value of the vnfOutputs property. - * - * @param value - * allowed object is - * {@link VnfOutputs } - * - */ - public void setVnfOutputs(VnfOutputs value) { - this.vnfOutputs = value; - } - - } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java deleted file mode 100644 index 41ebc7d556..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - - -package org.openecomp.mso.apihandlerinfra.vnfbeans; - - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}vnf-request" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "vnfRequest" -}) -@XmlRootElement(name = "vnf-requests") -public class VnfRequests { - - @XmlElement(name = "vnf-request") - protected List vnfRequest; - - /** - * Gets the value of the vnfRequest property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the vnfRequest property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getVnfRequest().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link VnfRequest } - * - * - */ - public List getVnfRequest() { - if (vnfRequest == null) { - vnfRequest = new ArrayList<>(); - } - return this.vnfRequest; - } - - public void setVnfRequest(List vnfRequest) { - this.vnfRequest=vnfRequest; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfType.java deleted file mode 100644 index e303c4e081..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfType.java +++ /dev/null @@ -1,148 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - - -package org.openecomp.mso.apihandlerinfra.vnfbeans; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="type" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "type", - "id", - "description" -}) -@XmlRootElement(name = "vnf-type") -public class VnfType { - - @XmlElement(required = true) - protected String type; - @XmlElement(required = true) - protected String id; - @XmlElement(required = true) - protected String description; - - /** - * Gets the value of the type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getType() { - return type; - } - - /** - * Sets the value of the type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setType(String value) { - this.type = value; - } - - /** - * Gets the value of the id property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getId() { - return id; - } - - /** - * Sets the value of the id property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setId(String value) { - this.id = value; - } - - /** - * Gets the value of the description property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDescription() { - return description; - } - - /** - * Sets the value of the description property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDescription(String value) { - this.description = value; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java deleted file mode 100644 index 46054e9e65..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - - -package org.openecomp.mso.apihandlerinfra.vnfbeans; - - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}vnf-type" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "vnfType" -}) -@XmlRootElement(name = "vnf-types") -public class VnfTypes { - - @XmlElement(name = "vnf-type") - protected List vnfType; - - /** - * Gets the value of the vnfType property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the vnfType property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getVnfType().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link VnfType } - * - * - */ - public List getVnfType() { - if (vnfType == null) { - vnfType = new ArrayList<>(); - } - return this.vnfType; - } - - public void setVnfType(List vnfType) { - this.vnfType = vnfType; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java deleted file mode 100644 index eb073e2fd0..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/mso/infra/vnf-request/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package org.openecomp.mso.apihandlerinfra.vnfbeans; - -- cgit 1.2.3-korg