summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-30 15:56:09 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-31 11:09:25 -0400
commit5a6a6de6f1a26a1897e4917a0df613e25a24eb70 (patch)
tree59a968f27b4b603aacc9d5e7b51fb598aeec5321 /mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap
parentb6dc38501f3b746426b42d9de4cc883d894149e8 (diff)
Containerization feature of SO
Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/common/ResponseBuilder.java61
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java46
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Actions.java25
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java70
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Constants.java52
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java1240
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java70
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java76
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java247
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Messages.java56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ModelType.java32
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoException.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java756
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java68
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java342
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RecipeLookupResult.java76
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestActionMap.java53
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java1661
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SpringContextHelper.java41
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Status.java36
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java337
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TestApi.java37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java57
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/CatalogDBConfig.java80
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/RequestDBConfig.java78
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/CompareModelsRequest.java68
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/DelE2ESvcResp.java37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EParameters.java83
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java113
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java120
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java46
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java61
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java35
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java69
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java49
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/LocationConstraint.java76
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java68
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java102
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java54
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java34
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java54
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java66
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/VimLocation.java45
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/package-info.java30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/RequestDetails.java55
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/RequestInfo.java73
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskList.java333
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskRequestReference.java56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariableValue.java107
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariables.java39
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TasksGetResponse.java36
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TasksRequest.java34
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/ValidResponses.java52
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/Value.java55
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/Variables.java74
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java68
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java238
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java81
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java297
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java76
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java156
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java461
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java103
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java162
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java81
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java55
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java61
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/SDCClientCallFailed.java36
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/TenantIsolationException.java36
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java120
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java42
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java118
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java236
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java183
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java300
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java83
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java227
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java89
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Action.java28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/CloudOrchestrationRequestList.java37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/CloudOrchestrationResponse.java38
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Distribution.java50
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/DistributionStatus.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/InstanceReferences.java60
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Manifest.java53
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java27
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RecoveryAction.java28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RelatedInstance.java68
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RelatedInstanceList.java45
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Request.java90
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestDetails.java104
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestInfo.java118
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestList.java93
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestParameters.java84
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestReferences.java96
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestStatus.java69
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/ResourceType.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/ServiceModelList.java59
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Status.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java95
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java115
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/TenantSyncResponse.java35
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/package-info.java29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ApplyUpdatedConfigValidation.java49
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java75
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InPlaceSoftwareUpdateValidation.java58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java81
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ModelInfoValidation.java111
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java60
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java60
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java232
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestInfoValidation.java67
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java100
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestScopeValidation.java49
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/SubscriberInfoValidation.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java102
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationInformation.java180
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationRule.java28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ActionType.java80
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ModelType.java32
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ObjectFactory.java150
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/RequestInfo.java286
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/RequestStatusType.java71
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VfModuleModelName.java261
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VfModuleModelNames.java104
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfInputs.java689
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfOutputs.java291
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfRequest.java179
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfRequests.java103
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfType.java148
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfTypes.java104
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/package-info.java30
135 files changed, 16524 insertions, 0 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/common/ResponseBuilder.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/common/ResponseBuilder.java
new file mode 100644
index 0000000000..67bbc3db8e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/common/ResponseBuilder.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.apihandler.common;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class ResponseBuilder {
+
+ @Value("${mso.infra.default.versions.apiMinorVersion}")
+ private String apiMinorVersion;
+ @Value("${mso.infra.default.versions.apiPatchVersion}")
+ private String apiPatchVersion;
+
+ public Response buildResponse(int status, String requestId, Object jsonResponse, String apiVersion) {
+
+ if (apiVersion.matches("v[1-9]")) {
+ apiVersion = apiVersion.substring(1);
+ }
+
+ String latestVersion = apiVersion + "." + apiMinorVersion + "." + apiPatchVersion;
+
+ javax.ws.rs.core.Response.ResponseBuilder builder = Response.status(status)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .header(CommonConstants.X_MINOR_VERSION, apiMinorVersion)
+ .header(CommonConstants.X_PATCH_VERSION, apiPatchVersion)
+ .header(CommonConstants.X_LATEST_VERSION, latestVersion);
+
+ if(StringUtils.isNotBlank(requestId)) {
+ builder.header(CommonConstants.X_TRANSACTION_ID, requestId);
+ }
+
+ return builder.entity(jsonResponse).build();
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java
new file mode 100644
index 0000000000..91ab580b07
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.onap.so.apihandler.filters;
+
+import java.io.IOException;
+import java.net.URI;
+
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
+import javax.ws.rs.core.UriInfo;
+
+import org.onap.so.apihandlerinfra.Constants;
+
+
+@PreMatching
+public class RequestUriFilter implements ContainerRequestFilter {
+
+ private String requestURI;
+ @Override
+ public void filter(ContainerRequestContext context) throws IOException {
+ UriInfo uriInfo = context.getUriInfo();
+ URI baseURI = uriInfo.getBaseUri();
+ requestURI = uriInfo.getPath();
+
+ if(requestURI.contains("onap/so/infra/serviceInstances")){
+ requestURI = requestURI.replaceFirst("serviceInstances", "serviceInstantiation");
+ if(!requestURI.contains(Constants.SERVICE_INSTANCE_PATH)){
+ //Adds /serviceInstances after the version provided in the URI
+ requestURI = new StringBuilder(requestURI).insert(requestURI.indexOf(Constants.SERVICE_INSTANTIATION_PATH) + 24, Constants.SERVICE_INSTANCE_PATH).toString();
+ }
+ requestURI = baseURI + requestURI;
+ URI uri = URI.create(requestURI);
+ context.setRequestUri(uri);
+ }
+ }
+ public String getRequestUri(){
+ return requestURI;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
new file mode 100644
index 0000000000..d801a94c9b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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.onap.so.apihandler.recipe;
+
+import java.io.IOException;
+
+import org.onap.so.logger.MsoLogger;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.client.ClientHttpResponse;
+import org.springframework.web.client.ResponseErrorHandler;
+
+
+
+public class CamundaClientErrorHandler implements ResponseErrorHandler{
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaClientErrorHandler.class);
+
+ @Override
+ public void handleError(ClientHttpResponse response) throws IOException {
+
+ msoLogger.debug(response.getBody().toString());
+ //msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR,
+ // MsoLogger.ResponseCode.CommunicationError, e.getMessage(), "BPMN", fullURL, null);
+ }
+
+ @Override
+ public boolean hasError(ClientHttpResponse response) throws IOException {
+ HttpStatus.Series series = response.getStatusCode().series();
+ return (HttpStatus.Series.CLIENT_ERROR.equals(series)
+ || HttpStatus.Series.SERVER_ERROR.equals(series));
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java
new file mode 100644
index 0000000000..3eee14e3bf
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java
@@ -0,0 +1,46 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+/*
+ * Enum for Status values returned by API Handler to Tail-F
+*/
+public enum Action implements Actions{
+ createInstance,
+ updateInstance,
+ deleteInstance,
+ configureInstance,
+ replaceInstance,
+ activateInstance,
+ deactivateInstance,
+ enablePort,
+ disablePort,
+ addRelationships,
+ removeRelationships,
+ inPlaceSoftwareUpdate,
+ applyUpdatedConfig,
+ completeTask,
+ assignInstance,
+ unassignInstance,
+ compareModel,
+ scaleInstance,
+ deactivateAndCloudDelete
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Actions.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Actions.java
new file mode 100644
index 0000000000..5dbe44f58b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Actions.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.apihandlerinfra;
+
+public interface Actions {
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java
new file mode 100644
index 0000000000..afe55a23a7
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java
@@ -0,0 +1,70 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+import java.util.concurrent.Executor;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+@SpringBootApplication(scanBasePackages = { "org.onap"})
+@EnableAsync
+public class ApiHandlerApplication {
+
+ @Value("${mso.async.core-pool-size}")
+ private int corePoolSize;
+
+ @Value("${mso.async.max-pool-size}")
+ private int maxPoolSize;
+
+ @Value("${mso.async.queue-capacity}")
+ private int queueCapacity;
+
+ private static final String LOGS_DIR = "logs_dir";
+
+ private static void setLogsDir() {
+ if (System.getProperty(LOGS_DIR) == null) {
+ System.getProperties().setProperty(LOGS_DIR, "./logs/apih/");
+ }
+ }
+
+ public static void main(String[] args) {
+ SpringApplication.run(ApiHandlerApplication.class, args);
+ System.getProperties().setProperty("mso.db", "MARIADB");
+ System.getProperties().setProperty("server.name", "Springboot");
+ setLogsDir();
+ }
+
+ @Bean
+ public Executor asyncExecutor() {
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+ executor.setCorePoolSize(corePoolSize);
+ executor.setMaxPoolSize(maxPoolSize);
+ executor.setQueueCapacity(queueCapacity);
+ executor.setThreadNamePrefix("mso-apihandler-infra-");
+ executor.initialize();
+ return executor;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Constants.java
new file mode 100644
index 0000000000..fe105a7637
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Constants.java
@@ -0,0 +1,52 @@
+/*-
+ * ============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.onap.so.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";
+
+ public final static String VNF_REQUEST_SCOPE = "vnf";
+ public final static String SERVICE_INSTANCE_PATH = "/serviceInstances";
+ public final static String SERVICE_INSTANTIATION_PATH = "/serviceInstantiation";
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
new file mode 100644
index 0000000000..ee50d920fe
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
@@ -0,0 +1,1240 @@
+/*-
+ * ============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.onap.so.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.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandler.common.RequestClient;
+import org.onap.so.apihandler.common.RequestClientFactory;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandler.common.ResponseHandler;
+import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.CompareModelsRequest;
+import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest;
+import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceRequest;
+import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceScaleRequest;
+import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.onap.so.db.catalog.data.repository.ServiceRecipeRepository;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.db.request.beans.OperationStatus;
+import org.onap.so.db.request.data.repository.OperationStatusRepository;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+import org.onap.so.serviceinstancebeans.RequestParameters;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.serviceinstancebeans.SubscriberInfo;
+import org.onap.so.utils.UUIDChecker;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Component
+@Path("/e2eServiceInstances")
+@Api(value = "/e2eServiceInstances", description = "API Requests for E2E Service Instances")
+public class E2EServiceInstances {
+
+ private HashMap<String, String> instanceIdMap = new HashMap<>();
+ private static MsoLogger msoLogger = MsoLogger
+ .getMsoLogger(MsoLogger.Catalog.APIH, E2EServiceInstances.class);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+ public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ public static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
+ public static final String EXCEPTION_CREATING_DB_RECORD = "Exception while creating record in DB";
+ public static final String EXCEPTION_COMMUNICATE_BPMN_ENGINE = "Exception while communicate with BPMN engine";
+
+ @Autowired
+ private MsoRequest msoRequest;
+
+ @Autowired
+ private RequestClientFactory requestClientFactory;
+
+ @Autowired
+ private OperationStatusRepository osRepo;
+
+ @Autowired
+ private ServiceRepository serviceRepo;
+
+ @Autowired
+ private ServiceRecipeRepository sRecipeRepo;
+
+ @Autowired
+ private ResponseBuilder builder;
+
+ /**
+ * POST Requests for E2E Service create Instance on a version provided
+ * @throws ApiException
+ */
+
+ @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) throws ApiException {
+
+ return processE2EserviceInstances(request, Action.createInstance, null,
+ version);
+ }
+
+ /**
+ * PUT Requests for E2E Service update Instance on a version provided
+ * @throws ApiException
+ */
+
+ @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) throws ApiException {
+
+ instanceIdMap.put("serviceId", serviceId);
+
+ return updateE2EserviceInstances(request, Action.updateInstance, instanceIdMap,
+ version);
+ }
+
+ /**
+ * DELETE Requests for E2E Service delete Instance on a specified version
+ * and serviceId
+ * @throws ApiException
+ */
+
+ @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) throws ApiException {
+
+ 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 getE2EServiceInstance(serviceId, operationId, version);
+ }
+
+ /**
+ * Scale Requests for E2E Service scale Instance on a specified version
+ * @throws ApiException
+ */
+
+ @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) throws ApiException {
+
+ 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
+ * @throws ApiException
+ */
+
+ @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) throws ApiException {
+
+ instanceIdMap.put("serviceId", serviceId);
+
+ return compareModelwithTargetVersion(request, Action.compareModel, instanceIdMap, version);
+ }
+
+ private Response compareModelwithTargetVersion(String requestJSON, Action action,
+ HashMap<String, String> instanceIdMap, String version) throws ApiException {
+
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("requestId is: " + requestId);
+
+ CompareModelsRequest e2eCompareModelReq = null;
+
+ 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, version);
+ 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, requestJSON, requestId, startTime, action, version);
+
+ }
+
+ private Response runCompareModelBPMWorkflow(CompareModelsRequest e2eCompareModelReq,
+ String requestJSON, String requestId, long startTime, Action action, String version) throws ApiException {
+
+ // Define RecipeLookupResult info here instead of query DB for efficiency
+ String workflowUrl = "/mso/async/services/CompareModelofE2EServiceInstance";
+ int recipeTimeout = 180;
+
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+
+ long subStartTime = System.currentTimeMillis();
+
+ try {
+ requestClient = requestClientFactory.getRequestClient(workflowUrl);
+
+ JSONObject jjo = new JSONObject(requestJSON);
+ String bpmnRequest = jjo.toString();
+
+ // Capture audit event
+ msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
+ String serviceId = instanceIdMap.get("serviceId");
+ String serviceType = e2eCompareModelReq.getServiceType();
+ RequestClientParameter postParam = new RequestClientParameter.Builder()
+ .setRequestId(requestId)
+ .setBaseVfModule(false)
+ .setRecipeTimeout(recipeTimeout)
+ .setRequestAction(action.name())
+ .setServiceInstanceId(serviceId)
+ .setServiceType(serviceType)
+ .setRequestDetails(bpmnRequest)
+ .setALaCarte(false).build();
+ response = requestClient.post(postParam);
+
+ 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, version);
+ 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, version);
+ 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, requestClient, respHandler, bpelStatus, action,
+ instanceIdMap, version);
+ }
+
+ private Response getE2EServiceInstance(String serviceId, String operationId, String version) {
+
+ GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse();
+
+ String apiVersion = version.substring(1);
+
+ long startTime = System.currentTimeMillis();
+
+ OperationStatus operationStatus = null;
+
+ try {
+ operationStatus = osRepo.findOneByServiceIdAndOperationId(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);
+ Response response = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ e.getMessage(),
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version);
+ 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, version);
+ 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 builder.buildResponse(HttpStatus.SC_OK, null, e2eServiceResponse, apiVersion);
+ }
+
+ private Response deleteE2EserviceInstances(String requestJSON,
+ Action action, HashMap<String, String> instanceIdMap, String version) throws ApiException {
+ // 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;
+
+ 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, version);
+ 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;
+ }
+
+ RecipeLookupResult recipeLookupResult = null;
+ try {
+ //TODO Get the service template model version uuid from AAI.
+ recipeLookupResult = getServiceInstanceOrchestrationURI(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);
+
+ Response response = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ "No communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+ alarmLogger.sendAlarm("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL, Messages.errors
+ .get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+ msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "Exception while communciate with Catalog DB", action, ModelType.service.name(), requestJSON);
+ 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;
+ }
+ if (recipeLookupResult == null) {
+ msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,
+ MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+ Response response = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
+
+ msoRequest.createErrorRequestRecord(Status.FAILED, requestId,"Recipe does not exist in catalog DB", action, ModelType.service.name(), requestJSON);
+
+ 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());
+
+ JSONObject jjo = new JSONObject(requestJSON);
+ jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));
+
+ String bpmnRequest = jjo.toString();
+
+ // Capture audit event
+ msoLogger
+ .debug("MSO API Handler Posting call to BPEL engine for url: "
+ + requestClient.getUrl());
+ String serviceId = instanceIdMap.get("serviceId");
+ String serviceInstanceType = e2eDelReq.getServiceType();
+ RequestClientParameter clientParam = new RequestClientParameter.Builder()
+ .setRequestId(requestId)
+ .setBaseVfModule(false)
+ .setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
+ .setRequestAction(action.name())
+ .setServiceInstanceId(serviceId)
+ .setServiceType(serviceInstanceType)
+ .setRequestDetails(bpmnRequest)
+ .setApiVersion(version)
+ .setALaCarte(false)
+ .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
+ response = requestClient.post(clientParam);
+
+ 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, version);
+ 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, version);
+ 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, requestClient, respHandler,
+ bpelStatus, action, instanceIdMap, version);
+ }
+
+ private Response updateE2EserviceInstances(String requestJSON, Action action,
+ HashMap<String, String> instanceIdMap, String version) throws ApiException {
+
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("requestId is: " + requestId);
+ E2EServiceInstanceRequest e2eSir = null;
+ String serviceId = instanceIdMap.get("serviceId");
+
+ 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, version);
+ 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;
+ }
+
+ ServiceInstancesRequest sir = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+ sir.getRequestDetails().getRequestParameters().setaLaCarte(true);
+ try {
+ parseRequest(sir, instanceIdMap, action, version, requestJSON, false, requestId);
+ } 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, version);
+ if (requestId != 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;
+ }
+
+ RecipeLookupResult recipeLookupResult = null;
+ try {
+ recipeLookupResult = getServiceInstanceOrchestrationURI(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);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+ 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;
+ }
+
+ if (recipeLookupResult == null) {
+ msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
+
+ 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();
+ String sirRequestJson = convertToString(sir);
+
+ try {
+ requestClient = requestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI());
+
+ // Capture audit event
+ msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
+ RequestClientParameter postParam = new RequestClientParameter.Builder()
+ .setRequestId(requestId)
+ .setBaseVfModule(false)
+ .setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
+ .setRequestAction(action.name())
+ .setServiceInstanceId(serviceId)
+ .setServiceType(serviceInstanceType)
+ .setRequestDetails(sirRequestJson)
+ .setApiVersion(version)
+ .setALaCarte(false)
+ .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
+ response = requestClient.post(postParam);
+
+ 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, version);
+ 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, version);
+ 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, requestClient, respHandler,
+ bpelStatus, action, instanceIdMap, version);
+ }
+
+ private Response processE2EserviceInstances(String requestJSON, Action action,
+ HashMap<String, String> instanceIdMap, String version) throws ApiException {
+
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("requestId is: " + requestId);
+ E2EServiceInstanceRequest e2eSir = null;
+
+ MsoRequest msoRequest = new MsoRequest();
+ 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, version);
+ 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;
+ }
+
+ ServiceInstancesRequest sir = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+ sir.getRequestDetails().getRequestParameters().setaLaCarte(true);
+ try {
+ parseRequest(sir, instanceIdMap, action, version, requestJSON, false, requestId);
+ } 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, version);
+ if (requestId != 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;
+ }
+
+ RecipeLookupResult recipeLookupResult = null;
+ try {
+ recipeLookupResult = getServiceInstanceOrchestrationURI(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);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+ 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;
+ }
+
+ if (recipeLookupResult == null) {
+ msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
+
+ 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();
+
+ String serviceId = "";
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+
+ long subStartTime = System.currentTimeMillis();
+ String sirRequestJson = convertToString(sir);
+
+ try {
+ requestClient = requestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI());
+
+ // Capture audit event
+ msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
+ RequestClientParameter parameter = new RequestClientParameter.Builder()
+ .setRequestId(requestId)
+ .setBaseVfModule(false)
+ .setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
+ .setRequestAction(action.name())
+ .setServiceInstanceId(serviceId)
+ .setServiceType(serviceInstanceType)
+ .setRequestDetails(sirRequestJson)
+ .setApiVersion(version)
+ .setALaCarte(false)
+ .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
+ response = requestClient.post(parameter);
+
+ 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, version);
+ 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, version);
+ 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, requestClient, respHandler,
+ bpelStatus, action, instanceIdMap, version);
+ }
+
+ private Response scaleE2EserviceInstances(String requestJSON,
+ Action action, HashMap<String, String> instanceIdMap, String version) throws ApiException {
+
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("requestId is: " + requestId);
+ E2EServiceInstanceScaleRequest e2eScaleReq = null;
+
+ 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, version);
+ 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;
+ }
+
+ RecipeLookupResult recipeLookupResult = null;
+ try {
+ //TODO Get the service template model version uuid from AAI.
+ recipeLookupResult = getServiceInstanceOrchestrationURI(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);
+
+ Response response = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ "No communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+ alarmLogger.sendAlarm("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL, Messages.errors
+ .get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+ msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "No communication to catalog DB " + e.getMessage(), action, ModelType.service.name(), requestJSON);
+ 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;
+ }
+ if (recipeLookupResult == null) {
+ msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,
+ MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+
+ Response response = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
+ msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "No recipe found in DB", action, ModelType.service.name(), requestJSON);
+ 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());
+
+ JSONObject jjo = new JSONObject(requestJSON);
+ jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));
+
+ String bpmnRequest = jjo.toString();
+
+ // Capture audit event
+ msoLogger
+ .debug("MSO API Handler Posting call to BPEL engine for url: "
+ + requestClient.getUrl());
+ String serviceId = instanceIdMap.get("serviceId");
+ String serviceInstanceType = e2eScaleReq.getService().getServiceType();
+ RequestClientParameter postParam = new RequestClientParameter.Builder()
+ .setRequestId(requestId)
+ .setBaseVfModule(false)
+ .setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
+ .setRequestAction(action.name())
+ .setServiceInstanceId(serviceId)
+ .setServiceType(serviceInstanceType)
+ .setRequestDetails(bpmnRequest)
+ .setApiVersion(version)
+ .setALaCarte(false)
+ .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
+ response = requestClient.post(postParam);
+
+ 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, version);
+ 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, version);
+ 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, requestClient, respHandler,
+ bpelStatus, action, instanceIdMap, version);
+ }
+
+ private Response beplStatusUpdate(String serviceId, long startTime,
+ RequestClient requestClient,
+ ResponseHandler respHandler, int bpelStatus, Action action,
+ HashMap<String, String> instanceIdMap, String version) {
+
+ String apiVersion = version.substring(1);
+
+ // BPMN accepted the request, the request is in progress
+ if (bpelStatus == HttpStatus.SC_ACCEPTED) {
+ String camundaJSONResponseBody = respHandler.getResponseBody();
+ 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 builder.buildResponse(HttpStatus.SC_ACCEPTED, null, camundaJSONResponseBody, apiVersion);
+ } else {
+ List<String> variables = new ArrayList<>();
+ variables.add(bpelStatus + "");
+ String camundaJSONResponseBody = respHandler.getResponseBody();
+ 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, version);
+ 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, version);
+ 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(String serviceModelUUID, Action action) {
+
+ RecipeLookupResult recipeLookupResult = getServiceURI(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(String serviceModelUUID, Action action) {
+
+ String defaultServiceModelName = "UUI_DEFAULT";
+
+ Service defaultServiceRecord = serviceRepo.findFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
+ ServiceRecipe defaultRecipe = sRecipeRepo.findFirstByServiceModelUUIDAndAction(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 = sRecipeRepo.findFirstByServiceModelUUIDAndAction(
+ 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.getParamXsd());
+
+ }
+
+ /**
+ * Converting E2EServiceInstanceRequest to ServiceInstanceRequest and
+ * passing it to camunda engine.
+ *
+ * @param e2eSir
+ * @return
+ */
+ private ServiceInstancesRequest mapReqJsonToSvcInstReq(E2EServiceInstanceRequest e2eSir,
+ String requestJSON) {
+
+ ServiceInstancesRequest 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<E2EUserParam> userParams;
+ // userParams =
+ // e2eSir.getService().getParameters().getRequestParameters().getUserParams();
+ List<Map<String, Object>> userParamList = new ArrayList<>();
+ Map<String, Object> userParamMap = new HashMap<>();
+ // complete json request updated in the camunda
+ userParamMap.put("UUIRequest", requestJSON);
+ userParamMap.put("ServiceInstanceName", e2eSir.getService().getName());
+
+ // Map<String, String> 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);
+
+ return sir;
+ }
+
+
+ private void parseRequest(ServiceInstancesRequest sir, HashMap<String, String> instanceIdMap, Action action, String version,
+ String requestJSON, Boolean aLaCarte, String requestId) throws ValidateException {
+ int reqVersion = Integer.parseInt(version.substring(1));
+ try {
+ msoRequest.parse(sir, instanceIdMap, action, version, requestJSON, reqVersion, aLaCarte);
+ } catch (Exception e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+
+ msoRequest.createErrorRequestRecord(Status.FAILED, requestId, validateException.getMessage(), action, ModelType.service.name(), requestJSON);
+
+ throw validateException;
+ }
+ }
+
+ private String convertToString(ServiceInstancesRequest sir) {
+ String returnString = null;
+ // 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/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
new file mode 100644
index 0000000000..7a8035ac63
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
@@ -0,0 +1,70 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+import javax.transaction.Transactional;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+
+import org.apache.http.HttpStatus;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.utils.UUIDChecker;
+import org.springframework.stereotype.Component;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+
+
+@Component
+@Path("/globalhealthcheck")
+@Api(value="/globalhealthcheck",description="APIH Infra Global Health Check")
+public class GlobalHealthcheckHandler {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH,GlobalHealthcheckHandler.class);
+ private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
+
+ public static final Response HEALTH_CHECK_RESPONSE = Response.status (HttpStatus.SC_OK)
+ .entity (CHECK_HTML)
+ .build ();
+
+ @GET
+ @Produces("text/html")
+ @ApiOperation(value="Performing global health check",response=Response.class)
+ @Transactional
+ public Response globalHealthcheck (@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn,
+ @Context ContainerRequestContext requestContext) {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("GlobalHealthcheck");
+ // Generated RequestId
+ String requestId = requestContext.getProperty("requestId").toString();
+ MsoLogger.setLogContext(requestId, null);
+ msoLogger.info(MessageEnum.APIH_GENERATED_REQUEST_ID, requestId, "", "");
+ return HEALTH_CHECK_RESPONSE;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
new file mode 100644
index 0000000000..1700e121f0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
@@ -0,0 +1,76 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+import javax.annotation.PostConstruct;
+import javax.ws.rs.ApplicationPath;
+
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.servlet.ServletProperties;
+import org.onap.so.apihandler.filters.RequestUriFilter;
+import org.onap.so.apihandlerinfra.exceptions.ApiExceptionMapper;
+import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestration;
+import org.onap.so.apihandlerinfra.tenantisolation.CloudResourcesOrchestration;
+import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging;
+import org.onap.so.web.exceptions.RuntimeExceptionMapper;
+import org.springframework.context.annotation.Configuration;
+
+import io.swagger.jaxrs.config.BeanConfig;
+import io.swagger.jaxrs.listing.ApiListingResource;
+import io.swagger.jaxrs.listing.SwaggerSerializers;
+
+@Configuration
+@ApplicationPath("/")
+public class JerseyConfiguration extends ResourceConfig {
+
+
+
+ @PostConstruct
+ public void setUp() {
+ register(GlobalHealthcheckHandler.class);
+ register(NodeHealthcheckHandler.class);
+ register(ServiceInstances.class);
+ register(TasksHandler.class);
+ register(CloudOrchestration.class);
+ register(CloudResourcesOrchestration.class);
+ register(OrchestrationRequests.class);
+ register(JaxRsFilterLogging.class);
+ register(ManualTasks.class);
+ register(TasksHandler.class);
+ register(ApiListingResource.class);
+ register(SwaggerSerializers.class);
+ register(ApiExceptionMapper.class);
+ register(RuntimeExceptionMapper.class);
+ register(RequestUriFilter.class);
+ register(E2EServiceInstances.class);
+ // this registration seems to be needed to get predictable
+ // execution behavior for the above JSON Exception Mappers
+ register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class);
+ property(ServletProperties.FILTER_FORWARD_ON_404, true);
+ BeanConfig beanConfig = new BeanConfig();
+ beanConfig.setVersion("1.0.2");
+ beanConfig.setSchemes(new String[] { "https" });
+ beanConfig.setResourcePackage("org.onap.so.apihandlerinfra");
+ beanConfig.setPrettyPrint(true);
+ beanConfig.setScan(true);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
new file mode 100644
index 0000000000..4d8c4ffbd8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
@@ -0,0 +1,247 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+import java.io.IOException;
+
+import javax.transaction.Transactional;
+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.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandler.common.RequestClient;
+import org.onap.so.apihandler.common.RequestClientFactory;
+import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandler.common.ResponseHandler;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference;
+import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest;
+import org.onap.so.apihandlerinfra.tasksbeans.Value;
+import org.onap.so.apihandlerinfra.tasksbeans.Variables;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+
+@Path("/tasks")
+@Component
+public class ManualTasks {
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, ManualTasks.class);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+
+ @org.springframework.beans.factory.annotation.Value("${mso.camunda.rest.task.uri}")
+ private String taskUri;
+
+ @Autowired
+ private RequestClientFactory reqClientFactory;
+
+ @Autowired
+ private MsoRequest msoRequest;
+
+ @Autowired
+ private ResponseBuilder builder;
+
+ @POST
+ @Path("/{version:[vV]1}/{taskId}/complete")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Complete specified task",response=Response.class)
+ @Transactional
+ public Response completeTask(String request, @PathParam("version") String version, @PathParam("taskId") String taskId,
+ @Context ContainerRequestContext requestContext) throws ApiException {
+
+ String requestId = requestContext.getProperty("requestId").toString();
+ MsoLogger.setLogContext(requestId, null);
+ msoLogger.info(MessageEnum.APIH_GENERATED_REQUEST_ID, requestId, "", "");
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("requestId is: " + requestId);
+ TasksRequest taskRequest = null;
+ String apiVersion = version.substring(1);
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ taskRequest= mapper.readValue(request, TasksRequest.class);
+
+ if (taskRequest.getRequestDetails() == null) {
+ throw new ValidationException("requestDetails");
+ }
+ if (taskRequest.getRequestDetails().getRequestInfo() == null) {
+ throw new ValidationException("requestInfo");
+ }
+ if (empty(taskRequest.getRequestDetails().getRequestInfo().getSource())) {
+ throw new ValidationException("source");
+ }
+ if (empty(taskRequest.getRequestDetails().getRequestInfo().getRequestorId())) {
+ throw new ValidationException("requestorId");
+ }
+
+ }catch(IOException e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed: " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+ catch(ValidationException e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON Object failed. " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build();
+ throw validateException;
+
+ }
+ //Create Request Record
+ InfraActiveRequests currentActiveReq = msoRequest.createRequestObject(taskRequest,Action.completeTask,requestId,Status.PENDING,request);
+
+ // Transform the request to Camunda-style Complete request
+ Variables variablesForComplete = new Variables();
+ Value sourceValue = new Value();
+ sourceValue.setValue(taskRequest.getRequestDetails().getRequestInfo().getSource());
+ Value responseValue = new Value();
+ responseValue.setValue(taskRequest.getRequestDetails().getRequestInfo().getResponseValue().name());
+ Value requestorIdValue = new Value();
+ requestorIdValue.setValue(taskRequest.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);
+ } catch(JsonProcessingException e){
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.UnknownError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Mapping of JSON object to Camunda request failed",
+ HttpStatus.SC_INTERNAL_SERVER_ERROR,ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+ long subStartTime = System.currentTimeMillis();
+ String requestUrl = taskUri + "/" + taskId + "/complete";
+ try {
+ requestClient = reqClientFactory.getRequestClient (requestUrl);
+ // Capture audit event
+
+ response = requestClient.post(camundaJsonReq);
+
+ } catch (Exception e) {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ AlarmLoggerInfo alarmLoggerInfo = new AlarmLoggerInfo.Builder("MsoConfigurationError", MsoAlarmLogger.CRITICAL, Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)).build();
+
+
+
+ BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
+ HttpStatus.SC_BAD_GATEWAY,ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo).alarmInfo(alarmLoggerInfo).build();
+
+ throw bpmnFailureException;
+ }
+
+ if (response == null) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
+ HttpStatus.SC_BAD_GATEWAY,ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo).build();
+
+ throw bpmnFailureException;
+
+ }
+
+ 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");
+
+ 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 (JsonProcessingException e) {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Request Failed due to bad response format" ,
+ bpelStatus,ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+ msoLogger.debug("Response to the caller: " + completeResp);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) completeResp);
+ return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, completeResp, apiVersion);
+ } else {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+
+
+ BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus),
+ bpelStatus,ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+
+ throw bpmnFailureException;
+
+ }
+
+ }
+
+ 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/onap/so/apihandlerinfra/Messages.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Messages.java
new file mode 100644
index 0000000000..555c536efb
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Messages.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.so.apihandler.common.ErrorNumbers;
+
+public class Messages {
+
+ protected static final Map<String,String> 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<String,String> getErrors() {
+ return errors;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ModelType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ModelType.java
new file mode 100644
index 0000000000..7b3ea3a181
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ModelType.java
@@ -0,0 +1,32 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/MsoException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoException.java
new file mode 100644
index 0000000000..defc904b05
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoException.java
@@ -0,0 +1,26 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+public enum MsoException {
+ ServiceException,
+ PolicyException,
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
new file mode 100644
index 0000000000..42ad5fc3d5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
@@ -0,0 +1,756 @@
+/*-
+ * ============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.onap.so.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.XMLConstants;
+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.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest;
+import org.onap.so.apihandlerinfra.validation.ApplyUpdatedConfigValidation;
+import org.onap.so.apihandlerinfra.validation.CloudConfigurationValidation;
+import org.onap.so.apihandlerinfra.validation.InPlaceSoftwareUpdateValidation;
+import org.onap.so.apihandlerinfra.validation.InstanceIdMapValidation;
+import org.onap.so.apihandlerinfra.validation.ModelInfoValidation;
+import org.onap.so.apihandlerinfra.validation.PlatformLOBValidation;
+import org.onap.so.apihandlerinfra.validation.ProjectOwningEntityValidation;
+import org.onap.so.apihandlerinfra.validation.RelatedInstancesValidation;
+import org.onap.so.apihandlerinfra.validation.RequestInfoValidation;
+import org.onap.so.apihandlerinfra.validation.RequestParametersValidation;
+import org.onap.so.apihandlerinfra.validation.RequestScopeValidation;
+import org.onap.so.apihandlerinfra.validation.SubscriberInfoValidation;
+import org.onap.so.apihandlerinfra.validation.UserParamsValidation;
+import org.onap.so.apihandlerinfra.validation.ValidationInformation;
+import org.onap.so.apihandlerinfra.validation.ValidationRule;
+import org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType;
+import org.onap.so.apihandlerinfra.vnfbeans.VnfInputs;
+import org.onap.so.apihandlerinfra.vnfbeans.VnfRequest;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
+import org.onap.so.serviceinstancebeans.InstanceDirection;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.PolicyException;
+import org.onap.so.serviceinstancebeans.RelatedInstance;
+import org.onap.so.serviceinstancebeans.RelatedInstanceList;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+import org.onap.so.serviceinstancebeans.RequestParameters;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.ServiceException;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+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;
+
+
+@Component
+public class MsoRequest {
+
+ @Autowired
+ private InfraActiveRequestsRepository iarRepo;
+
+ @Autowired
+ private ResponseBuilder builder;
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH,MsoRequest.class);
+
+ public Response buildServiceErrorResponse (int httpResponseCode, MsoException exceptionType,
+ String errorText, String messageId, List<String> variables, String version) {
+
+ if(errorText.length() > 1999){
+ errorText = errorText.substring(0, 1999);
+ }
+
+ RequestError re = new RequestError();
+
+ if("PolicyException".equals(exceptionType.name())){
+
+ PolicyException pe = new PolicyException();
+ pe.setMessageId(messageId);
+ pe.setText(errorText);
+ if(variables != null){
+ for(String variable: variables){
+ pe.getVariables().add(variable);
+ }
+ }
+ re.setPolicyException(pe);
+
+ } else {
+
+ ServiceException se = new ServiceException();
+ se.setMessageId(messageId);
+ se.setText(errorText);
+ 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 builder.buildResponse(httpResponseCode, null, requestErrorStr, version);
+ }
+
+
+
+ // Parse request JSON
+ public void parse (ServiceInstancesRequest sir, HashMap<String,String> instanceIdMap, Actions action, String version,
+ String originalRequestJSON, int reqVersion, Boolean aLaCarteFlag) throws ValidationException, IOException {
+
+ msoLogger.debug ("Validating the Service Instance request");
+ List<ValidationRule> rules = new ArrayList<>();
+ msoLogger.debug ("Incoming version is: " + version + " coverting to int: " + reqVersion);
+ RequestParameters requestParameters = sir.getRequestDetails().getRequestParameters();
+ ValidationInformation info = new ValidationInformation(sir, instanceIdMap, action,
+ reqVersion, aLaCarteFlag, requestParameters);
+
+ rules.add(new InstanceIdMapValidation());
+
+ if(reqVersion >= 6 && action == Action.inPlaceSoftwareUpdate){
+ rules.add(new InPlaceSoftwareUpdateValidation());
+ }else if(reqVersion >= 6 && action == Action.applyUpdatedConfig){
+ rules.add(new ApplyUpdatedConfigValidation());
+ }else{
+ rules.add(new RequestScopeValidation());
+ rules.add(new RequestParametersValidation());
+ rules.add(new RequestInfoValidation());
+ rules.add(new ModelInfoValidation());
+ rules.add(new CloudConfigurationValidation());
+ rules.add(new SubscriberInfoValidation());
+ rules.add(new PlatformLOBValidation());
+ rules.add(new ProjectOwningEntityValidation());
+ rules.add(new RelatedInstancesValidation());
+ }
+ if(reqVersion >= 7 && requestParameters != null && requestParameters.getUserParams() != null){
+ for(Map<String, Object> params : requestParameters.getUserParams()){
+ if(params.containsKey("service")){
+ ObjectMapper obj = new ObjectMapper();
+ String input = obj.writeValueAsString(params.get("service"));
+ Service validate = obj.readValue(input, Service.class);
+ info.setUserParams(validate);
+ rules.add(new UserParamsValidation());
+ break;
+ }
+ }
+ }
+ for(ValidationRule rule : rules){
+ rule.validate(info);
+ }
+ }
+ void parseOrchestration (ServiceInstancesRequest sir) throws ValidationException {
+ RequestInfo requestInfo = sir.getRequestDetails().getRequestInfo();
+
+ if (requestInfo == null) {
+ throw new ValidationException ("requestInfo");
+ }
+
+ if (empty (requestInfo.getSource ())) {
+ throw new ValidationException ("source");
+ }
+ if (empty (requestInfo.getRequestorId ())) {
+ throw new ValidationException ("requestorId");
+ }
+ }
+ public Map<String, List<String>> getOrchestrationFilters (MultivaluedMap<String, String> queryParams) throws ValidationException {
+
+ String queryParam = null;
+ Map<String, List<String>> orchestrationFilterParams = new HashMap<>();
+
+
+ for (Entry<String,List<String>> 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<String> 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 InfraActiveRequests createRequestObject (ServiceInstancesRequest servInsReq, Actions action, String requestId,
+ Status status, String originalRequestJSON, String requestScope) {
+ InfraActiveRequests aq = new InfraActiveRequests ();
+ try {
+ if (null == servInsReq) {
+ servInsReq = new ServiceInstancesRequest ();
+ }
+
+ String networkType = "";
+ String vnfType = "";
+ aq.setRequestId (requestId);
+ aq.setRequestAction(action.toString());
+ aq.setAction(action.toString());
+
+ Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
+
+ aq.setStartTime (startTimeStamp);
+ RequestInfo requestInfo =servInsReq.getRequestDetails().getRequestInfo();
+ 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 (servInsReq.getRequestDetails().getModelInfo() != null || (action == Action.inPlaceSoftwareUpdate || action == Action.applyUpdatedConfig)) {
+ aq.setRequestScope(requestScope);
+ }
+
+ if (servInsReq.getRequestDetails().getCloudConfiguration() != null) {
+ CloudConfiguration cloudConfiguration = servInsReq.getRequestDetails().getCloudConfiguration();
+ if(cloudConfiguration.getLcpCloudRegionId() != null) {
+ aq.setAicCloudRegion(cloudConfiguration.getLcpCloudRegionId());
+ }
+
+ if(cloudConfiguration.getTenantId() != null) {
+ aq.setTenantId(cloudConfiguration.getTenantId());
+ }
+
+ }
+
+ if(servInsReq.getServiceInstanceId() != null){
+ aq.setServiceInstanceId(servInsReq.getServiceInstanceId());
+ }
+
+ if(servInsReq.getVnfInstanceId() != null){
+ aq.setVnfId(servInsReq.getVnfInstanceId());
+ }
+
+ if(ModelType.service.name().equalsIgnoreCase(requestScope)){
+ if(servInsReq.getRequestDetails().getRequestInfo().getInstanceName() != null){
+ aq.setServiceInstanceName(requestInfo.getInstanceName());
+ }
+ }
+
+ if(ModelType.network.name().equalsIgnoreCase(requestScope)){
+ aq.setNetworkName(servInsReq.getRequestDetails().getRequestInfo().getInstanceName());
+ aq.setNetworkType(networkType);
+ aq.setNetworkId(servInsReq.getNetworkInstanceId());
+ }
+
+ if(ModelType.volumeGroup.name().equalsIgnoreCase(requestScope)){
+ aq.setVolumeGroupId(servInsReq.getVolumeGroupInstanceId());
+ aq.setVolumeGroupName(servInsReq.getRequestDetails().getRequestInfo().getInstanceName());
+ aq.setVnfType(vnfType);
+
+ }
+
+ if(ModelType.vfModule.name().equalsIgnoreCase(requestScope)){
+ aq.setVfModuleName(requestInfo.getInstanceName());
+ aq.setVfModuleModelName(servInsReq.getRequestDetails().getModelInfo().getModelName());
+ aq.setVfModuleId(servInsReq.getVfModuleInstanceId());
+ aq.setVolumeGroupId(servInsReq.getVolumeGroupInstanceId());
+ aq.setVnfType(vnfType);
+
+ }
+
+ if(ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
+ aq.setConfigurationId(servInsReq.getConfigurationId());
+ aq.setConfigurationName(requestInfo.getInstanceName());
+ }
+
+ if(ModelType.vnf.name().equalsIgnoreCase(requestScope)){
+ aq.setVnfName(requestInfo.getInstanceName());
+ if (null != servInsReq.getRequestDetails()) {
+ RelatedInstanceList[] instanceList = servInsReq.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 (originalRequestJSON);
+
+ aq.setRequestStatus (status.toString ());
+ aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request", e);
+
+ if (!status.equals (Status.FAILED)) {
+ throw e;
+ }
+ }
+ return aq;
+ }
+
+ public InfraActiveRequests createRequestObject (TasksRequest taskRequest, Action action, String requestId,
+ Status status, String originalRequestJSON) {
+ InfraActiveRequests aq = new InfraActiveRequests ();
+ try {
+
+ org.onap.so.apihandlerinfra.tasksbeans.RequestInfo requestInfo = taskRequest.getRequestDetails().getRequestInfo();
+ 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());
+ }
+ }
+
+ aq.setRequestBody (originalRequestJSON);
+ aq.setRequestStatus (status.toString ());
+ aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
+
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request", e);
+
+ if (!status.equals (Status.FAILED)) {
+ throw e;
+ }
+ }
+ return aq;
+ }
+
+ public void createErrorRequestRecord (Status status, String requestId, String errorMessage, Actions action, String requestScope, String requestJSON) {
+ try {
+ InfraActiveRequests request = new InfraActiveRequests(requestId);
+ Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
+ request.setStartTime (startTimeStamp);
+ request.setRequestStatus(status.toString());
+ request.setStatusMessage(errorMessage);
+ request.setProgress((long) 100);
+ request.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ request.setRequestAction(action.toString());
+ request.setRequestScope(requestScope);
+ request.setRequestBody(requestJSON);
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ request.setEndTime(endTimeStamp);
+ iarRepo.save(request);
+ } 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 String getServiceType (VnfInputs vnfInputs) {
+ if (vnfInputs.getServiceType () != null)
+ return vnfInputs.getServiceType ();
+ if (vnfInputs.getServiceId () != null)
+ return vnfInputs.getServiceId ();
+ return null;
+ }
+
+ public long translateStatus (RequestStatusType status) {
+ switch (status) {
+ case FAILED:
+ case COMPLETE:
+ return Constants.PROGRESS_REQUEST_COMPLETED;
+ case IN_PROGRESS:
+ return Constants.PROGRESS_REQUEST_IN_PROGRESS;
+ default:
+ return 0;
+ }
+ }
+
+ public void updateStatus(InfraActiveRequests aq, Status status, String errorMessage){
+ if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
+ aq.setStatusMessage (errorMessage);
+ aq.setProgress(new Long(100));
+ aq.setRequestStatus(status.toString());
+ Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
+ aq.setEndTime (endTimeStamp);
+ iarRepo.save(aq);
+ }
+ }
+
+
+
+
+ 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 ();
+ tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
+ tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET,"");
+ 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(VnfRequest vnfReq, VnfInputs vnfInputs, 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);
+
+ vnfReq.setVnfInputs(vnfInputs);
+
+ }
+
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+
+ public String getRequestJSON(ServiceInstancesRequest sir) 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(ServiceInstancesRequest sir) {
+ if(sir.getRequestDetails().getRequestParameters() != null &&
+ sir.getRequestDetails().getRequestParameters().getALaCarte() != null)
+ return sir.getRequestDetails().getRequestParameters().getALaCarte();
+
+ return false;
+ }
+
+
+ public String getNetworkType(ServiceInstancesRequest sir, String requestScope) {
+ if(requestScope.equalsIgnoreCase(ModelType.network.name()))
+ return sir.getRequestDetails().getModelInfo().getModelName();
+ else return null;
+ }
+
+
+ public String getServiceInstanceType(ServiceInstancesRequest sir, String requestScope) {
+ if(requestScope.equalsIgnoreCase(ModelType.network.name()))
+ return sir.getRequestDetails().getModelInfo().getModelName();
+ else return null;
+ }
+
+
+ public String getSDCServiceModelVersion(ServiceInstancesRequest sir) {
+ String sdcServiceModelVersion = null;
+ if(sir.getRequestDetails().getRelatedInstanceList() != null)
+ for(RelatedInstanceList relatedInstanceList : sir.getRequestDetails().getRelatedInstanceList()){
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo ();
+ if(relatedInstanceModelInfo.getModelType().equals(ModelType.service))
+ sdcServiceModelVersion = relatedInstanceModelInfo.getModelVersion ();
+ }
+ return sdcServiceModelVersion;
+ }
+
+
+ public String getVfModuleType(ServiceInstancesRequest sir, String requestScope, Actions action, int reqVersion) {
+
+ String serviceInstanceType = null;
+ String networkType = null;
+ String vnfType = null;
+ String vfModuleType = null;
+ String vfModuleModelName = null;
+ ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
+ 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 (action != Action.deleteInstance) {
+
+ 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) && reqVersion == 6))) {
+ isDestinationVnfPresent = true;
+ }
+ }
+
+ if(ModelType.connectionPoint.equals(relatedInstanceModelInfo.getModelType()) && ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
+ isConnectionPointPresent = true;
+ }
+ }
+
+
+ if(relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
+ isRelatedServiceInstancePresent = true;
+ serviceModelName = relatedInstanceModelInfo.getModelName ();
+ asdcServiceModelVersion = relatedInstanceModelInfo.getModelVersion ();
+ } else if(relatedInstanceModelInfo.getModelType().equals(ModelType.vnf) && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) {
+ isRelatedVnfInstancePresent = true;
+ vnfModelName = relatedInstanceModelInfo.getModelCustomizationName();
+ } else if(relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
+ volumeGroupId = relatedInstance.getInstanceId ();
+ }
+ }
+
+ if(requestScope.equalsIgnoreCase (ModelType.volumeGroup.name ())) {
+ serviceInstanceType = serviceModelName;
+ vnfType = serviceModelName + "/" + vnfModelName;
+ }
+ else if(requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) {
+ vfModuleModelName = modelInfo.getModelName ();
+ serviceInstanceType = serviceModelName;
+ vnfType = serviceModelName + "/" + vnfModelName;
+ vfModuleType = vnfType + "::" + vfModuleModelName;
+ sir.setVolumeGroupInstanceId (volumeGroupId);
+ }
+ else if (requestScope.equalsIgnoreCase (ModelType.vnf.name ()))
+ vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName();
+
+ }
+
+ return vfModuleType;
+
+ }
+
+ public String getVnfType(ServiceInstancesRequest sir, String requestScope, Actions action, int reqVersion) {
+
+ String serviceInstanceType = null;
+ String networkType = null;
+ String vnfType = null;
+ String vfModuleType = null;
+ String vfModuleModelName = null;
+ ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
+ MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, MsoRequest.class);
+ 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 (action != Action.deleteInstance) {
+
+ 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) && reqVersion == 6))) {
+ isDestinationVnfPresent = true;
+ }
+ }
+
+ if(ModelType.connectionPoint.equals(relatedInstanceModelInfo.getModelType()) && ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
+ isConnectionPointPresent = true;
+ }
+ }
+
+
+ if(relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
+ isRelatedServiceInstancePresent = true;
+ serviceModelName = relatedInstanceModelInfo.getModelName ();
+ asdcServiceModelVersion = relatedInstanceModelInfo.getModelVersion ();
+ } else if(relatedInstanceModelInfo.getModelType().equals(ModelType.vnf) && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) {
+ isRelatedVnfInstancePresent = true;
+ vnfModelName = relatedInstanceModelInfo.getModelCustomizationName();
+ } else if(relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
+ volumeGroupId = relatedInstance.getInstanceId ();
+ }
+ }
+
+ if(requestScope.equalsIgnoreCase (ModelType.volumeGroup.name ())) {
+ serviceInstanceType = serviceModelName;
+ vnfType = serviceModelName + "/" + vnfModelName;
+ }
+ else if(requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) {
+ vfModuleModelName = modelInfo.getModelName ();
+ serviceInstanceType = serviceModelName;
+ vnfType = serviceModelName + "/" + vnfModelName;
+ vfModuleType = vnfType + "::" + vfModuleModelName;
+ sir.setVolumeGroupInstanceId (volumeGroupId);
+ }
+ else if (requestScope.equalsIgnoreCase (ModelType.vnf.name ()))
+ vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName();
+
+ }
+
+ return vnfType;
+
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java
new file mode 100644
index 0000000000..35f196b263
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java
@@ -0,0 +1,68 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+import java.net.UnknownHostException;
+
+import javax.transaction.Transactional;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+
+import org.apache.http.HttpStatus;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.utils.UUIDChecker;
+import org.springframework.stereotype.Component;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+@Path("/nodehealthcheck")
+@Api(value="/nodehealthcheck",description="API Handler Infra Node Health Check")
+@Component
+public class NodeHealthcheckHandler {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, NodeHealthcheckHandler.class);
+
+ private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
+
+ public static final Response HEALTH_CHECK_RESPONSE = Response.status (HttpStatus.SC_OK)
+ .entity (CHECK_HTML)
+ .build ();
+
+ @GET
+ @Produces("text/html")
+ @ApiOperation(value="Performing node health check",response=Response.class)
+ @Transactional
+ public Response nodeHealthcheck (@Context ContainerRequestContext requestContext) throws UnknownHostException {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("NodeHealthcheck");
+ // Generated RequestId
+ String requestId = requestContext.getProperty("requestId").toString();
+ MsoLogger.setLogContext(requestId, null);
+ msoLogger.info(MessageEnum.APIH_GENERATED_REQUEST_ID, requestId, "", "");
+ return HEALTH_CHECK_RESPONSE;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
new file mode 100644
index 0000000000..e1993aa632
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -0,0 +1,342 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.transaction.Transactional;
+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.commons.lang.StringUtils;
+import org.apache.http.HttpStatus;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse;
+import org.onap.so.serviceinstancebeans.GetOrchestrationResponse;
+import org.onap.so.serviceinstancebeans.InstanceReferences;
+import org.onap.so.serviceinstancebeans.Request;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestList;
+import org.onap.so.serviceinstancebeans.RequestStatus;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+@Path("onap/so/infra/orchestrationRequests")
+@Api(value="onap/so/infra/orchestrationRequests",description="API Requests for Orchestration requests")
+@Component
+public class OrchestrationRequests {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, OrchestrationRequests.class);
+
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+
+ @Autowired
+ private InfraActiveRequestsRepository infraActiveRequestsRepository;
+
+ @Autowired
+ private MsoRequest msoRequest;
+
+ @Autowired
+ private ResponseBuilder builder;
+
+ @GET
+ @Path("/{version:[vV][4-7]}/{requestId}")
+ @ApiOperation(value="Find Orchestrated Requests for a given requestId",response=Response.class)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response getOrchestrationRequest(@PathParam("requestId") String requestId, @PathParam("version") String version) throws ApiException{
+
+ String apiVersion = version.substring(1);
+ GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse();
+
+
+ InfraActiveRequests requestDB = null;
+
+ try {
+ requestDB = infraActiveRequestsRepository.findOneByRequestIdOrClientRequestId(requestId, requestId);
+ } catch (Exception e) {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.AvailabilityError).build();
+ AlarmLoggerInfo alarmLoggerInfo = new AlarmLoggerInfo.Builder("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL, Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)).build();
+
+
+
+ ValidateException validateException = new ValidateException.Builder("Exception while communciate with Request DB - Infra Request Lookup",
+ HttpStatus.SC_NOT_FOUND,ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB).cause(e).errorInfo(errorLoggerInfo).alarmInfo(alarmLoggerInfo).build();
+
+ throw validateException;
+
+ }
+
+ if(requestDB == null) {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB",
+ HttpStatus.SC_NO_CONTENT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+
+ Request request = mapInfraActiveRequestToRequest(requestDB);
+
+ orchestrationResponse.setRequest(request);
+
+ return builder.buildResponse(HttpStatus.SC_OK, requestId, orchestrationResponse, apiVersion);
+ }
+
+ @GET
+ @Path("/{version:[vV][4-7]}")
+ @ApiOperation(value="Find Orchestrated Requests for a URI Information",response=Response.class)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version) throws ApiException{
+
+ long startTime = System.currentTimeMillis ();
+
+ MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+
+ List<InfraActiveRequests> activeRequests = null;
+
+ GetOrchestrationListResponse orchestrationList = null;
+ Map<String, List<String>> orchestrationMap;
+ String apiVersion = version.substring(1);
+
+ try {
+ orchestrationMap = msoRequest.getOrchestrationFilters(queryParams);
+ if (orchestrationMap.isEmpty()) {
+ throw new ValidationException("At least one filter query param must be specified");
+ }
+ }catch(ValidationException ex){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.DataError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder(ex.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+
+ }
+
+ activeRequests = infraActiveRequestsRepository.getOrchestrationFiltersFromInfraActive(orchestrationMap);
+
+ orchestrationList = new GetOrchestrationListResponse();
+ List<RequestList> requestLists = new ArrayList<>();
+
+ for(InfraActiveRequests infraActive : activeRequests){
+ RequestList requestList = new RequestList();
+ Request request = mapInfraActiveRequestToRequest(infraActive);
+ requestList.setRequest(request);
+ requestLists.add(requestList);
+ }
+
+ orchestrationList.setRequestList(requestLists);
+ return builder.buildResponse(HttpStatus.SC_OK, null, orchestrationList, apiVersion);
+ }
+
+
+ @POST
+ @Path("/{version: [vV][4-7]}/{requestId}/unlock")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Unlock Orchestrated Requests for a given requestId",response=Response.class)
+ @Transactional
+ public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) throws ApiException{
+
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("requestId is: " + requestId);
+ ServiceInstancesRequest sir = null;
+
+ InfraActiveRequests infraActiveRequest = null;
+ Request request = null;
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ } catch(IOException e){
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+
+ }
+ try{
+ msoRequest.parseOrchestration(sir);
+ } catch (Exception e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+
+ infraActiveRequest = infraActiveRequestsRepository.findOneByRequestIdOrClientRequestId(requestId, requestId);
+ if(infraActiveRequest == null) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.BusinessProcesssError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Null response from RequestDB when searching by RequestId",
+ HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+
+ }else{
+ String status = infraActiveRequest.getRequestStatus();
+ if(status.equalsIgnoreCase("IN_PROGRESS") || status.equalsIgnoreCase("PENDING") || status.equalsIgnoreCase("PENDING_MANUAL_TASK")){
+ infraActiveRequest.setRequestStatus("UNLOCKED");
+ infraActiveRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ infraActiveRequestsRepository.save(infraActiveRequest);
+ }else{
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+ }
+ return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build ();
+ }
+
+ private Request mapInfraActiveRequestToRequest(InfraActiveRequests iar) throws ApiException{
+
+ String requestBody = iar.getRequestBody();
+ Request request = new Request();
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ request.setRequestId(iar.getRequestId());
+ request.setRequestScope(iar.getRequestScope());
+ request.setRequestType(iar.getRequestAction());
+
+ InstanceReferences ir = new InstanceReferences();
+ if(iar.getNetworkId() != null)
+ ir.setNetworkInstanceId(iar.getNetworkId());
+ if(iar.getNetworkName() != null)
+ ir.setNetworkInstanceName(iar.getNetworkName());
+ if(iar.getServiceInstanceId() != null)
+ ir.setServiceInstanceId(iar.getServiceInstanceId());
+ if(iar.getServiceInstanceName() != null)
+ ir.setServiceInstanceName(iar.getServiceInstanceName());
+ if(iar.getVfModuleId() != null)
+ ir.setVfModuleInstanceId(iar.getVfModuleId());
+ if(iar.getVfModuleName() != null)
+ ir.setVfModuleInstanceName(iar.getVfModuleName());
+ if(iar.getVnfId() != null)
+ ir.setVnfInstanceId(iar.getVnfId());
+ if(iar.getVnfName() != null)
+ ir.setVnfInstanceName(iar.getVnfName());
+ if(iar.getVolumeGroupId() != null)
+ ir.setVolumeGroupInstanceId(iar.getVolumeGroupId());
+ if(iar.getVolumeGroupName() != null)
+ ir.setVolumeGroupInstanceName(iar.getVolumeGroupName());
+ if(iar.getRequestorId() != null)
+ ir.setRequestorId(iar.getRequestorId());
+
+
+ request.setInstanceReferences(ir);
+
+ RequestDetails requestDetails = null;
+
+ if(StringUtils.isNotBlank(requestBody)) {
+ try {
+ if(requestBody.contains("\"requestDetails\":")){
+ ServiceInstancesRequest sir = mapper.readValue(requestBody, ServiceInstancesRequest.class);
+ requestDetails = sir.getRequestDetails();
+ } else {
+ requestDetails = mapper.readValue(requestBody, RequestDetails.class);
+ }
+ } catch (IOException e) {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : ",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+ }
+ request.setRequestDetails(requestDetails);
+
+ if(iar.getStartTime() != null) {
+ String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(iar.getStartTime()) + " GMT";
+ request.setStartTime(startTimeStamp);
+ }
+
+ RequestStatus status = new RequestStatus();
+ if(iar.getStatusMessage() != null){
+ status.setStatusMessage(iar.getStatusMessage());
+ }
+
+ if(iar.getEndTime() != null){
+ String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(iar.getEndTime()) + " GMT";
+ status.setFinishTime(endTimeStamp);
+ }
+
+
+ if(iar.getRequestStatus() != null){
+ status.setRequestState(iar.getRequestStatus());
+ }
+
+ if(iar.getProgress() != null){
+ status.setPercentProgress(iar.getProgress().intValue());
+ }
+
+ request.setRequestStatus(status);
+
+ return request;
+ }
+ }
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RecipeLookupResult.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RecipeLookupResult.java
new file mode 100644
index 0000000000..83d270552d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RecipeLookupResult.java
@@ -0,0 +1,76 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/RequestActionMap.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestActionMap.java
new file mode 100644
index 0000000000..86dd048120
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestActionMap.java
@@ -0,0 +1,53 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/*
+ * Map of actions to RequestActions
+*/
+public class RequestActionMap {
+ private static final Map<String, String> 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/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
new file mode 100644
index 0000000000..ba6635e737
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -0,0 +1,1661 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import javax.transaction.Transactional;
+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.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+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 org.onap.so.apihandler.camundabeans.CamundaResponse;
+import org.onap.so.apihandler.common.CommonConstants;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandler.common.RequestClient;
+import org.onap.so.apihandler.common.RequestClientFactory;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandler.common.ResponseHandler;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
+import org.onap.so.apihandlerinfra.exceptions.ClientConnectionException;
+import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException;
+import org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.exceptions.VfModuleNotFoundException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.db.catalog.beans.NetworkResource;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfRecipe;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.data.repository.NetworkRecipeRepository;
+import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.ServiceRecipeRepository;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.VFModuleRepository;
+import org.onap.so.db.catalog.data.repository.VnfComponentRecipeRepository;
+import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.VnfRecipeRepository;
+import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.Networks;
+import org.onap.so.serviceinstancebeans.RelatedInstance;
+import org.onap.so.serviceinstancebeans.RelatedInstanceList;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestParameters;
+import org.onap.so.serviceinstancebeans.RequestReferences;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+import org.onap.so.serviceinstancebeans.VfModules;
+import org.onap.so.serviceinstancebeans.Vnfs;
+import org.onap.so.utils.UUIDChecker;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+@Component
+@Path("/onap/so/infra/serviceInstantiation")
+@Api(value="/onap/so/infra/serviceInstantiation",description="Infrastructure API Requests for Service Instances")
+public class ServiceInstances {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH,MsoRequest.class);
+ private static String NAME = "name";
+ private static String VALUE = "value";
+
+ @Autowired
+ private Environment env;
+
+ @Autowired
+ private RequestClientFactory reqClientFactory;
+
+ @Autowired
+ private ServiceRepository serviceRepo;
+
+ @Autowired
+ private ServiceRecipeRepository serviceRecipeRepo;
+
+ @Autowired
+ private NetworkRecipeRepository networkRecipeRepo;
+
+ @Autowired
+ private NetworkResourceCustomizationRepository networkCustomizationRepo;
+
+ @Autowired
+ private VnfResourceRepository vnfRepo;
+
+ @Autowired
+ private VnfCustomizationRepository vnfCustomRepo;
+
+ @Autowired
+ private VnfRecipeRepository vnfRecipeRepo;
+
+ @Autowired
+ private VFModuleCustomizationRepository vfModuleCustomRepo;
+
+ @Autowired
+ private VFModuleRepository vfModuleRepo;
+
+ @Autowired
+ private VnfComponentRecipeRepository vnfComponentRecipeRepo;
+
+ @Autowired
+ private InfraActiveRequestsRepository iar;
+
+ @Autowired
+ private ResponseBuilder builder;
+
+ @Autowired
+ private MsoRequest msoRequest;
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Create a Service Instance on a version provided",response=Response.class)
+ @Transactional
+ public Response createServiceInstance(String request, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ return serviceInstances(request, Action.createInstance, null, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/activate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Activate provided Service Instance",response=Response.class)
+ @Transactional
+ public Response activateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ return serviceInstances(request, Action.activateInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/deactivate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Deactivate provided Service Instance",response=Response.class)
+ @Transactional
+ public Response deactivateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ return serviceInstances(request, Action.deactivateInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @DELETE
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Delete provided Service Instance",response=Response.class)
+ @Transactional
+ public Response deleteServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ return serviceInstances(request, Action.deleteInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][7]}/serviceInstances/assign")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Assign Service Instance", response=Response.class)
+ @Transactional
+ public Response assignServiceInstance(String request, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ return serviceInstances(request, Action.assignInstance, null, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/unassign")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Unassign Service Instance", response=Response.class)
+ @Transactional
+ public Response unassignServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ return serviceInstances(request, Action.unassignInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Create Port Mirroring Configuration",response=Response.class)
+ @Transactional
+ public Response createPortConfiguration(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ return configurationRecipeLookup(request, Action.createInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @DELETE
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Delete provided Port",response=Response.class)
+ @Transactional
+ public Response deletePortConfiguration(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("configurationInstanceId") String configurationInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("configurationInstanceId", configurationInstanceId);
+ return configurationRecipeLookup(request, Action.deleteInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/enablePort")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Enable Port Mirroring",response=Response.class)
+ @Transactional
+ public Response enablePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("configurationInstanceId") String configurationInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("configurationInstanceId", configurationInstanceId);
+ return configurationRecipeLookup(request, Action.enablePort, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/disablePort")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Disable Port Mirroring",response=Response.class)
+ @Transactional
+ public Response disablePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("configurationInstanceId") String configurationInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("configurationInstanceId", configurationInstanceId);
+ return configurationRecipeLookup(request, Action.disablePort, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/activate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Activate Port Mirroring",response=Response.class)
+ @Transactional
+ public Response activatePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("configurationInstanceId") String configurationInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("configurationInstanceId", configurationInstanceId);
+ return configurationRecipeLookup(request, Action.activateInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/deactivate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Deactivate Port Mirroring",response=Response.class)
+ @Transactional
+ public Response deactivatePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("configurationInstanceId") String configurationInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("configurationInstanceId", configurationInstanceId);
+ return configurationRecipeLookup(request, Action.deactivateInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/addRelationships")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Add Relationships to a Service Instance",response=Response.class)
+ @Transactional
+ public Response addRelationships(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ return configurationRecipeLookup(request, Action.addRelationships, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/removeRelationships")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Remove Relationships from Service Instance",response=Response.class)
+ @Transactional
+ public Response removeRelationships(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ return configurationRecipeLookup(request, Action.removeRelationships, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Create VNF on a specified version and serviceInstance",response=Response.class)
+ @Transactional
+ public Response createVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ return serviceInstances(request, Action.createInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/replace")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Replace provided VNF instance",response=Response.class)
+ @Transactional
+ public Response replaceVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ return serviceInstances(request, Action.replaceInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @PUT
+ @Path("/{version:[vV][5-7]}/serviceInstances/{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)
+ @Transactional
+ public Response updateVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ return serviceInstances(request, Action.updateInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][6-7]}/serviceInstances/{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, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ return serviceInstances(request, Action.applyUpdatedConfig, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+
+ @DELETE
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Delete provided VNF instance",response=Response.class)
+ @Transactional
+ public Response deleteVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ return serviceInstances(request, Action.deleteInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{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)
+ @Transactional
+ public Response createVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ return serviceInstances(request, Action.createInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{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)
+ @Transactional
+ public Response replaceVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId);
+ return serviceInstances(request, Action.replaceInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @PUT
+ @Path("/{version:[vV][5-7]}/serviceInstances/{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)
+ @Transactional
+ public Response updateVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId);
+ return serviceInstances(request, Action.updateInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/inPlaceSoftwareUpdate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Perform VNF software update",response=Response.class)
+ @Transactional
+ public Response inPlaceSoftwareUpdate(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ return serviceInstances(request, Action.inPlaceSoftwareUpdate, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @DELETE
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Delete provided VfModule instance",response=Response.class)
+ @Transactional
+ public Response deleteVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId);
+ return serviceInstances(request, Action.deleteInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/deactivateAndCloudDelete")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Deactivate and Cloud Delete VfModule instance",response=Response.class)
+ @Transactional
+ public Response deactivateAndCloudDeleteVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId, @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId);
+ Response response = serviceInstances(request, Action.deactivateAndCloudDelete, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ return response;
+ }
+
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{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)
+ @Transactional
+ public Response createVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ return serviceInstances(request, Action.createInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @PUT
+ @Path("/{version:[vV][5-7]}/serviceInstances/{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)
+ @Transactional
+ public Response updateVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId);
+ return serviceInstances(request, Action.updateInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @DELETE
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Delete provided VolumeGroup instance",response=Response.class)
+ @Transactional
+ public Response deleteVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId);
+ return serviceInstances(request, Action.deleteInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @POST
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Create NetworkInstance on a specified version and serviceInstance ",response=Response.class)
+ @Transactional
+ public Response createNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ return serviceInstances(request, Action.createInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @PUT
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Update VolumeGroup on a specified version, serviceInstance, networkInstance",response=Response.class)
+ @Transactional
+ public Response updateNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("networkInstanceId") String networkInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("networkInstanceId", networkInstanceId);
+ return serviceInstances(request, Action.updateInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ @DELETE
+ @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Delete provided Network instance",response=Response.class)
+ @Transactional
+ public Response deleteNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("networkInstanceId") String networkInstanceId, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("networkInstanceId", networkInstanceId);
+ return serviceInstances(request, Action.deleteInstance, instanceIdMap, version, requestId, getRequestUri(requestContext));
+ }
+
+ public String getRequestUri(ContainerRequestContext context){
+ String requestUri = context.getUriInfo().getPath();
+ requestUri = requestUri.substring(requestUri.indexOf("/serviceInstantiation/") + 22);
+ return requestUri;
+ }
+
+ public Response serviceInstances(String requestJSON, Actions action, HashMap<String, String> instanceIdMap, String version, String requestId, String requestUri) throws ApiException {
+ String serviceInstanceId = (instanceIdMap ==null)? null:instanceIdMap.get("serviceInstanceId");
+ Boolean aLaCarte = null;
+ long startTime = System.currentTimeMillis ();
+ ServiceInstancesRequest sir = null;
+ String apiVersion = version.substring(1);
+
+ sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, sir, msoRequest, requestId, requestUri);
+ String requestScope = deriveRequestScope(action, sir, requestUri);
+ InfraActiveRequests currentActiveReq = msoRequest.createRequestObject (sir, action, requestId, Status.PENDING, requestJSON, requestScope);
+ if(sir.getRequestDetails().getRequestParameters() != null){
+ aLaCarte = sir.getRequestDetails().getRequestParameters().getALaCarte();
+ }
+ parseRequest(sir, instanceIdMap, action, version, requestJSON, aLaCarte, requestId, currentActiveReq);
+ setInstanceId(currentActiveReq, requestScope, null, instanceIdMap);
+
+ int requestVersion = Integer.parseInt(version.substring(1));
+ String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
+ boolean alaCarteFlag = msoRequest.getAlacarteFlag(sir);
+ String vnfType = msoRequest.getVnfType(sir,requestScope,action,requestVersion);
+ String networkType = msoRequest.getNetworkType(sir,requestScope);
+ String sdcServiceModelVersion = msoRequest.getSDCServiceModelVersion(sir);
+ String serviceInstanceType = msoRequest.getServiceInstanceType(sir,requestScope);
+ String vfModuleType = msoRequest.getVfModuleType(sir,requestScope,action,requestVersion);
+
+ if(requestScope.equalsIgnoreCase(ModelType.vnf.name()) && vnfType != null){
+ currentActiveReq.setVnfType(vnfType);
+ }else if(requestScope.equalsIgnoreCase(ModelType.network.name()) && networkType != null){
+ currentActiveReq.setNetworkType(networkType);
+ }
+
+ InfraActiveRequests dup = null;
+
+
+ dup = duplicateCheck(action, instanceIdMap, startTime, msoRequest, instanceName,requestScope, currentActiveReq);
+
+ if (dup != null) {
+ buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, startTime, msoRequest, instanceName, requestScope, dup);
+ }
+ ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse();
+
+ RequestReferences referencesResponse = new RequestReferences();
+
+ referencesResponse.setRequestId(requestId);
+
+ serviceResponse.setRequestReferences(referencesResponse);
+ Boolean isBaseVfModule = false;
+
+ RecipeLookupResult recipeLookupResult = getServiceInstanceOrchestrationURI(sir, action, alaCarteFlag, currentActiveReq);
+
+ ModelType modelType;
+ ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
+ if (action == Action.applyUpdatedConfig || action == Action.inPlaceSoftwareUpdate) {
+ modelType = ModelType.vnf;
+ }else {
+ modelType =modelInfo.getModelType();
+ }
+
+ if (modelType.equals(ModelType.vfModule)) {
+
+
+ // Get VF Module-specific base module indicator
+ VfModule vfm;
+
+ String modelVersionId = modelInfo.getModelVersionId();
+
+ if(modelVersionId != null) {
+ vfm = vfModuleRepo.findByModelUUID(modelVersionId);
+ } else {
+ vfm = vfModuleRepo.findByModelInvariantUUIDAndModelVersion(modelInfo.getModelInvariantId(), modelInfo.getModelVersion());
+ }
+
+ if (vfm != null) {
+ if (vfm.getIsBase()) {
+ 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
+
+ String serviceVersionText = "";
+ if (sdcServiceModelVersion != null && !sdcServiceModelVersion.isEmpty ()) {
+ serviceVersionText = " with version " + sdcServiceModelVersion;
+ }
+
+ String errorMessage = "VnfType " + vnfType + " and VF Module Model Name " + modelInfo.getModelName() + serviceVersionText + " not found in MSO Catalog DB";
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ VfModuleNotFoundException vfModuleException = new VfModuleNotFoundException.Builder(errorMessage, HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build();
+ msoRequest.updateStatus(currentActiveReq, Status.FAILED, vfModuleException.getMessage());
+
+ throw vfModuleException;
+ }
+ }
+
+
+ serviceInstanceId = "";
+ String vnfId = "";
+ String vfModuleId = "";
+ String volumeGroupId = "";
+ String networkId = "";
+ String correlationId = "";
+
+ if(sir.getServiceInstanceId () != null){
+ serviceInstanceId = sir.getServiceInstanceId ();
+ }
+
+ if(sir.getVnfInstanceId () != null){
+ vnfId = sir.getVnfInstanceId ();
+ }
+
+ if(sir.getVfModuleInstanceId () != null){
+ vfModuleId = sir.getVfModuleInstanceId ();
+ }
+
+ if(sir.getVolumeGroupInstanceId () != null){
+ volumeGroupId = sir.getVolumeGroupInstanceId ();
+ }
+
+ if(sir.getNetworkInstanceId () != null){
+ networkId = sir.getNetworkInstanceId ();
+ }
+
+ if (sir.getCorrelationId() != null) {
+ correlationId = sir.getCorrelationId();
+ }
+ iar.save(currentActiveReq);
+
+ if(!requestScope.equalsIgnoreCase(ModelType.service.name())){
+ aLaCarte = true;
+ }else if(aLaCarte == null){
+ aLaCarte = false;
+ }
+
+ return postBPELRequest(currentActiveReq,action, requestId, startTime, requestJSON, recipeLookupResult.getOrchestrationURI(), recipeLookupResult.getRecipeTimeout(),
+ isBaseVfModule, serviceInstanceId, correlationId, vnfId, vfModuleId, volumeGroupId, networkId, null,
+ serviceInstanceType,vnfType, vfModuleType,networkType, apiVersion, aLaCarte, requestUri, null, requestScope, sir);
+ }
+
+ private String deriveRequestScope(Actions action, ServiceInstancesRequest sir, String requestUri) {
+ if(action == Action.inPlaceSoftwareUpdate || action == Action.applyUpdatedConfig){
+ return (ModelType.vnf.name());
+ }else{
+ String requestScope;
+ if(sir.getRequestDetails().getModelInfo().getModelType() == null){
+ requestScope = requestScopeFromUri(requestUri);
+ }else{
+ requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
+ }
+ return requestScope;
+ }
+ }
+ private String requestScopeFromUri(String requestUri){
+ String requestScope;
+ if(requestUri.contains(ModelType.network.name())){
+ requestScope = ModelType.network.name();
+ }else if(requestUri.contains(ModelType.vfModule.name())){
+ requestScope = ModelType.vfModule.name();
+ }else if(requestUri.contains(ModelType.volumeGroup.name())){
+ requestScope = ModelType.volumeGroup.name();
+ }else if(requestUri.contains(ModelType.configuration.name())){
+ requestScope = ModelType.configuration.name();
+ }else if(requestUri.contains(ModelType.vnf.name())){
+ requestScope = ModelType.vnf.name();
+ }else{
+ requestScope = ModelType.service.name();
+ }
+ return requestScope;
+ }
+ private Response postBPELRequest(InfraActiveRequests currentActiveReq, Actions action, String requestId, long startTime, String msoRawRequest,
+ String orchestrationUri, int timeOut, Boolean isBaseVfModule,
+ String serviceInstanceId, String correlationId, String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String configurationId, String serviceInstanceType, String vnfType, String vfModuleType, String networkType,
+ String apiVersion, boolean aLaCarte, String requestUri, String paramXsd, String requestScope, ServiceInstancesRequest sir) throws ApiException {
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+ try {
+ requestClient = reqClientFactory.getRequestClient (orchestrationUri);
+ response = requestClient.post(new RequestClientParameter.Builder()
+ .setRequestId(requestId)
+ .setBaseVfModule(isBaseVfModule)
+ .setRecipeTimeout(timeOut)
+ .setRequestAction(action.toString())
+ .setServiceInstanceId(serviceInstanceId)
+ .setCorrelationId(correlationId)
+ .setVnfId(vnfId)
+ .setVfModuleId(vfModuleId)
+ .setVolumeGroupId(volumeGroupId)
+ .setNetworkId(networkId)
+ .setConfigurationId(configurationId)
+ .setServiceType(serviceInstanceType)
+ .setVnfType(vnfType)
+ .setVfModuleType(vfModuleType)
+ .setNetworkType(networkType)
+ .setRequestDetails(mapJSONtoMSOStyle(msoRawRequest, sir, aLaCarte, action))
+ .setApiVersion(apiVersion)
+ .setALaCarte(aLaCarte)
+ .setRecipeParamXsd(paramXsd)
+ .setRequestUri(requestUri).build());
+
+
+ } catch (Exception e) {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ String url = requestClient != null ? requestClient.getUrl() : "";
+ ClientConnectionException clientException = new ClientConnectionException.Builder(url, HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build();
+ msoRequest.updateStatus(currentActiveReq, Status.FAILED, clientException.getMessage());
+
+ throw clientException;
+ }
+
+ if (response == null) {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ClientConnectionException clientException = new ClientConnectionException.Builder(requestClient.getUrl(), HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo).build();
+
+ msoRequest.updateStatus(currentActiveReq, Status.FAILED, clientException.getMessage());
+
+ throw clientException;
+ }
+
+ 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) {
+ ServiceInstancesResponse jsonResponse;
+ CamundaResponse camundaResp = respHandler.getResponse();
+
+ if("Success".equalsIgnoreCase(camundaResp.getMessage())) {
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ jsonResponse = mapper.readValue(camundaResp.getResponse(), ServiceInstancesResponse.class);
+ } catch (IOException e) {
+ e.printStackTrace();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ValidateException validateException = new ValidateException.Builder("Exception caught mapping Camunda JSON response to object", HttpStatus.SC_NOT_ACCEPTABLE, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ currentActiveReq.setRequestStatus(Status.FAILED.name());
+ currentActiveReq.setStatusMessage(validateException.getMessage());
+ throw validateException;
+ }
+
+ currentActiveReq.setRequestStatus(Status.IN_PROGRESS.name());
+ setInstanceId(currentActiveReq, requestScope, jsonResponse.getRequestReferences().getInstanceId(), new HashMap<>());
+
+ iar.save(currentActiveReq);
+ return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, jsonResponse, apiVersion);
+ }
+ }
+
+ List<String> variables = new ArrayList<>();
+ variables.add(bpelStatus + "");
+ String camundaJSONResponseBody = respHandler.getResponseBody ();
+ if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build();
+ BPMNFailureException bpmnException = new BPMNFailureException.Builder(String.valueOf(bpelStatus) + camundaJSONResponseBody, bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
+ .errorInfo(errorLoggerInfo).build();
+
+ msoRequest.updateStatus(currentActiveReq, Status.FAILED, bpmnException.getMessage());
+
+ throw bpmnException;
+ } else {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build();
+
+
+ BPMNFailureException servException = new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
+ .errorInfo(errorLoggerInfo).build();
+ msoRequest.updateStatus(currentActiveReq, Status.FAILED, servException.getMessage());
+
+ throw servException;
+ }
+ }
+
+ private void setInstanceId(InfraActiveRequests currentActiveReq, String requestScope, String instanceId, Map<String, String> instanceIdMap) {
+ if(StringUtils.isNotBlank(instanceId)) {
+ if(ModelType.service.name().equalsIgnoreCase(requestScope)) {
+ currentActiveReq.setServiceInstanceId(instanceId);
+ } else if(ModelType.vnf.name().equalsIgnoreCase(requestScope)) {
+ currentActiveReq.setVnfId(instanceId);
+ } else if(ModelType.vfModule.name().equalsIgnoreCase(requestScope)) {
+ currentActiveReq.setVfModuleId(instanceId);
+ } else if(ModelType.volumeGroup.name().equalsIgnoreCase(requestScope)) {
+ currentActiveReq.setVolumeGroupId(instanceId);
+ } else if(ModelType.network.name().equalsIgnoreCase(requestScope)) {
+ currentActiveReq.setNetworkId(instanceId);
+ } else if(ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
+ currentActiveReq.setConfigurationId(instanceId);
+ }
+ } else if(instanceIdMap != null && !instanceIdMap.isEmpty()) {
+ if(instanceIdMap.get("serviceInstanceId") != null){
+ currentActiveReq.setServiceInstanceId(instanceIdMap.get("serviceInstanceId"));
+ }
+ if(instanceIdMap.get("vnfInstanceId") != null){
+ currentActiveReq.setVnfId(instanceIdMap.get("vnfInstanceId"));
+ }
+ if(instanceIdMap.get("vfModuleInstanceId") != null){
+ currentActiveReq.setVfModuleId(instanceIdMap.get("vfModuleInstanceId"));
+ }
+ if(instanceIdMap.get("volumeGroupInstanceId") != null){
+ currentActiveReq.setVolumeGroupId(instanceIdMap.get("volumeGroupInstanceId"));
+ }
+ if(instanceIdMap.get("networkInstanceId") != null){
+ currentActiveReq.setNetworkId(instanceIdMap.get("networkInstanceId"));
+ }
+ if(instanceIdMap.get("configurationInstanceId") != null){
+ currentActiveReq.setConfigurationId(instanceIdMap.get("configurationInstanceId"));
+ }
+ }
+ }
+
+ protected String mapJSONtoMSOStyle(String msoRawRequest, ServiceInstancesRequest serviceInstRequest, boolean isAlaCarte, Actions action) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ ServiceInstancesRequest sir = mapper.readValue(msoRawRequest, ServiceInstancesRequest.class);
+ if( !isAlaCarte && Action.createInstance.equals(action) && serviceInstRequest != null &&
+ serviceInstRequest.getRequestDetails() != null &&
+ serviceInstRequest.getRequestDetails().getRequestParameters() != null) {
+ sir.getRequestDetails().setCloudConfiguration(serviceInstRequest.getRequestDetails().getCloudConfiguration());
+ sir.getRequestDetails().getRequestParameters().setUserParams(serviceInstRequest.getRequestDetails().getRequestParameters().getUserParams());
+ }
+ msoLogger.debug("Value as string: " + mapper.writeValueAsString(sir));
+ return mapper.writeValueAsString(sir);
+ }
+
+ private void buildErrorOnDuplicateRecord(InfraActiveRequests currentActiveReq, Actions action, HashMap<String, String> instanceIdMap, long startTime, MsoRequest msoRequest,
+ String instanceName, String requestScope, InfraActiveRequests dup) throws ApiException {
+
+ // Found the duplicate record. Return the appropriate error.
+ String instance = null;
+ if(instanceName != null){
+ instance = instanceName;
+ }else{
+ instance = instanceIdMap.get(requestScope + "InstanceId");
+ }
+ //List<String> variables = new ArrayList<String>();
+ //variables.add(dup.getRequestStatus());
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ DuplicateRequestException dupException = new DuplicateRequestException.Builder(requestScope,instance,dup.getRequestStatus(),dup.getRequestId(), HttpStatus.SC_CONFLICT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
+ .errorInfo(errorLoggerInfo).build();
+
+ msoRequest.updateStatus(currentActiveReq, Status.FAILED, dupException.getMessage());
+
+ throw dupException;
+ }
+
+ private InfraActiveRequests duplicateCheck(Actions action, HashMap<String, String> instanceIdMap, long startTime,
+ MsoRequest msoRequest, String instanceName, String requestScope, InfraActiveRequests currentActiveReq) throws ApiException {
+ InfraActiveRequests dup = null;
+ try {
+ if(!(instanceName==null && requestScope.equals("service") && (action == Action.createInstance || action == Action.activateInstance || action == Action.assignInstance))){
+ dup = iar.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
+ }
+ } catch (Exception e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Duplicate Check Request", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+
+ msoRequest.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
+
+ throw validateException;
+ }
+ return dup;
+ }
+
+ private ServiceInstancesRequest convertJsonToServiceInstanceRequest(String requestJSON, Actions action, long startTime,
+ ServiceInstancesRequest sir, MsoRequest msoRequest, String requestId, String requestUri) throws ApiException {
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ return mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+
+ } catch (IOException e) {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+ ValidateException validateException = new ValidateException.Builder("Error mapping request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ String requestScope = requestScopeFromUri(requestUri);
+
+ msoRequest.createErrorRequestRecord(Status.FAILED, requestId, validateException.getMessage(), action, requestScope, requestJSON);
+
+ throw validateException;
+ }
+ }
+
+ private void parseRequest(ServiceInstancesRequest sir, HashMap<String, String> instanceIdMap, Actions action, String version,
+ String requestJSON, Boolean aLaCarte, String requestId, InfraActiveRequests currentActiveReq) throws ValidateException {
+ int reqVersion = Integer.parseInt(version.substring(1));
+ try {
+ msoRequest.parse(sir, instanceIdMap, action, version, requestJSON, reqVersion, aLaCarte);
+ } catch (Exception e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+
+ msoRequest.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
+
+ throw validateException;
+ }
+ }
+
+ private RecipeLookupResult getServiceInstanceOrchestrationURI(ServiceInstancesRequest sir, Actions action, boolean alaCarteFlag,
+ InfraActiveRequests currentActiveReq) throws ApiException {
+ RecipeLookupResult recipeLookupResult = null;
+ //if the aLaCarte flag is set to TRUE, the API-H should choose the VID_DEFAULT recipe for the requested action
+ ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
+ // Query MSO Catalog DB
+
+ if (action == Action.applyUpdatedConfig || action == Action.inPlaceSoftwareUpdate) {
+ recipeLookupResult = getDefaultVnfUri(sir, action);
+ } else if (modelInfo.getModelType().equals(ModelType.service)) {
+ try {
+ recipeLookupResult = getServiceURI(sir, action,alaCarteFlag);
+ } catch (IOException e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+
+ msoRequest.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
+
+ throw validateException;
+ }
+ } else if (modelInfo.getModelType().equals(ModelType.vfModule) ||
+ modelInfo.getModelType().equals(ModelType.volumeGroup) || modelInfo.getModelType().equals(ModelType.vnf)) {
+ try {
+ recipeLookupResult = getVnfOrVfModuleUri( sir, action);
+ } catch (ValidationException e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+
+ msoRequest.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
+
+ throw validateException;
+ }
+ }else if (modelInfo.getModelType().equals(ModelType.network)) {
+ try {
+ recipeLookupResult = getNetworkUri( sir, action);
+ } catch (ValidationException e) {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ msoRequest.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
+
+ throw validateException;
+ }
+ }
+
+ if (recipeLookupResult == null) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ RecipeNotFoundException recipeNotFoundExceptionException = new RecipeNotFoundException.Builder("Recipe could not be retrieved from catalog DB.", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR)
+ .errorInfo(errorLoggerInfo).build();
+
+ msoRequest.updateStatus(currentActiveReq, Status.FAILED, recipeNotFoundExceptionException.getMessage());
+ throw recipeNotFoundExceptionException;
+ }
+ return recipeLookupResult;
+ }
+
+
+ private RecipeLookupResult getServiceURI(ServiceInstancesRequest servInstReq, Actions action, boolean alaCarteFlag) throws IOException {
+ // SERVICE REQUEST
+ // Construct the default service name
+ // TODO need to make this a configurable property
+ String defaultServiceModelName = getDefaultModel(servInstReq);
+ RequestDetails requestDetails = servInstReq.getRequestDetails();
+ ModelInfo modelInfo = requestDetails.getModelInfo();
+ org.onap.so.db.catalog.beans.Service serviceRecord;
+ List<org.onap.so.db.catalog.beans.Service> serviceRecordList;
+ ServiceRecipe recipe = null;
+
+ if(alaCarteFlag){
+ serviceRecord = serviceRepo.findByModelNameOrderByModelVersionDesc(defaultServiceModelName);
+ if(serviceRecord !=null){
+ recipe = serviceRecord.getRecipes().get(action.toString());
+ }
+ }else{
+ serviceRecord = serviceRepo.findOneByModelUUID(modelInfo.getModelVersionId());
+ recipe = serviceRecipeRepo.findFirstByServiceModelUUIDAndAction(modelInfo.getModelVersionId(), action.toString());
+ if (recipe == null){
+ serviceRecordList = serviceRepo.findByModelInvariantUUIDOrderByModelVersionDesc(modelInfo.getModelInvariantId());
+ if(!serviceRecordList.isEmpty()){
+ for(org.onap.so.db.catalog.beans.Service record : serviceRecordList){
+ recipe = record.getRecipes().get(action.toString());
+ if(recipe != null){
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ //if an aLaCarte flag was sent in the request, throw an error if the recipe was not found
+ RequestParameters reqParam = requestDetails.getRequestParameters();
+ if(reqParam!=null && alaCarteFlag && recipe==null){
+ return null;
+ } else if(!alaCarteFlag && recipe != null && Action.createInstance.equals(action)) {
+ mapToLegacyRequest(requestDetails);
+ }else if (recipe == null) { //aLaCarte wasn't sent, so we'll try the default
+ serviceRecord = serviceRepo.findByModelNameOrderByModelVersionDesc(defaultServiceModelName);
+ recipe = serviceRecord.getRecipes().get( action.toString());
+ }
+ if(modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(serviceRecord.getModelUUID());
+ }
+ if(recipe==null){
+ return null;
+ }
+ return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+ }
+
+ protected void mapToLegacyRequest(RequestDetails requestDetails) throws IOException {
+ RequestParameters reqParam;
+ if (requestDetails.getRequestParameters() == null) {
+ reqParam = new RequestParameters();
+ } else {
+ reqParam = requestDetails.getRequestParameters();
+ }
+ if(requestDetails.getCloudConfiguration() == null) {
+ CloudConfiguration cloudConfig = configureCloudConfig(reqParam);
+ if(cloudConfig != null) {
+ requestDetails.setCloudConfiguration(cloudConfig);
+ }
+ }
+
+ List<Map<String, Object>> userParams = configureUserParams(reqParam);
+ if(!userParams.isEmpty()) {
+ if (reqParam == null) {
+ requestDetails.setRequestParameters(new RequestParameters());
+ }
+ requestDetails.getRequestParameters().setUserParams(userParams);
+ }
+ }
+
+ protected CloudConfiguration configureCloudConfig(RequestParameters reqParams) throws IOException {
+
+ for(Map<String, Object> params : reqParams.getUserParams()){
+ if(params.containsKey("service")){
+ Service service = serviceMapper(params);
+
+ Optional<CloudConfiguration> targetConfiguration = addCloudConfig(service.getCloudConfiguration());
+
+ if (targetConfiguration.isPresent()) {
+ return targetConfiguration.get();
+ } else {
+ for(Networks network : service.getResources().getNetworks()) {
+ targetConfiguration = addCloudConfig(network.getCloudConfiguration());
+ if(targetConfiguration.isPresent()) {
+ return targetConfiguration.get();
+ }
+ }
+
+ for(Vnfs vnf : service.getResources().getVnfs()) {
+ targetConfiguration = addCloudConfig(vnf.getCloudConfiguration());
+
+ if(targetConfiguration.isPresent()) {
+ return targetConfiguration.get();
+ }
+
+ for(VfModules vfModule : vnf.getVfModules()) {
+ targetConfiguration = addCloudConfig(vfModule.getCloudConfiguration());
+
+ if(targetConfiguration.isPresent()) {
+ return targetConfiguration.get();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private Optional<CloudConfiguration> addCloudConfig(CloudConfiguration sourceCloudConfiguration) {
+ CloudConfiguration targetConfiguration = new CloudConfiguration();
+ if(sourceCloudConfiguration != null) {
+ targetConfiguration.setAicNodeClli(sourceCloudConfiguration.getAicNodeClli());
+ targetConfiguration.setTenantId(sourceCloudConfiguration.getTenantId());
+ targetConfiguration.setLcpCloudRegionId(sourceCloudConfiguration.getLcpCloudRegionId());
+ return Optional.of(targetConfiguration);
+ }
+ return Optional.empty();
+ }
+
+ protected List<Map<String, Object>> configureUserParams(RequestParameters reqParams) throws IOException {
+ msoLogger.debug("Configuring UserParams for Macro Request");
+ Map<String, Object> userParams = new HashMap<>();
+
+ for(Map<String, Object> params : reqParams.getUserParams()){
+ if(params.containsKey("service")){
+ Service service = serviceMapper(params);
+
+ addUserParams(userParams, service.getInstanceParams());
+
+ for(Networks network : service.getResources().getNetworks()) {
+ addUserParams(userParams, network.getInstanceParams());
+ }
+
+ for(Vnfs vnf: service.getResources().getVnfs()) {
+ addUserParams(userParams, vnf.getInstanceParams());
+
+ for(VfModules vfModule: vnf.getVfModules()) {
+ addUserParams(userParams, vfModule.getInstanceParams());
+ }
+ }
+ }
+ }
+
+ return mapFlatMapToNameValue(userParams);
+ }
+
+ private Service serviceMapper(Map<String, Object> params)
+ throws JsonProcessingException, IOException, JsonParseException, JsonMappingException {
+ ObjectMapper obj = new ObjectMapper();
+ String input = obj.writeValueAsString(params.get("service"));
+ return obj.readValue(input, Service.class);
+ }
+
+ private void addUserParams(Map<String, Object> targetUserParams, List<Map<String, String>> sourceUserParams) {
+ for(Map<String, String> map : sourceUserParams) {
+ for (Map.Entry<String, String> entry : map.entrySet()) {
+ targetUserParams.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+
+ protected List<Map<String, Object>> mapFlatMapToNameValue(Map<String, Object> flatMap) {
+ List<Map<String, Object>> targetUserParams = new ArrayList<>();
+
+ for(Map.Entry<String, Object> map : flatMap.entrySet()) {
+ Map<String, Object> targetMap = new HashMap<>();
+ targetMap.put(NAME, map.getKey());
+ targetMap.put(VALUE, map.getValue());
+ targetUserParams.add(targetMap);
+ }
+ return targetUserParams;
+ }
+
+ private RecipeLookupResult getVnfOrVfModuleUri(ServiceInstancesRequest servInstReq, Actions action) throws ValidationException {
+
+ ModelInfo modelInfo = servInstReq.getRequestDetails().getModelInfo();
+ String vnfComponentType = modelInfo.getModelType().name();
+
+ RelatedInstanceList[] instanceList = null;
+ if (servInstReq.getRequestDetails() != null) {
+ instanceList = servInstReq.getRequestDetails().getRelatedInstanceList();
+ }
+
+ Recipe recipe = null;
+ String defaultSource = getDefaultModel(servInstReq);
+ 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=null;
+ // Validation for vnfResource
+
+ if(modelCustomizationId!=null) {
+ vrc = vnfCustomRepo.findOneByModelCustomizationUUID(modelCustomizationId);
+ if(vrc != null){
+ vnfResource = vrc.getVnfResources();
+ }
+ } else {
+ org.onap.so.db.catalog.beans.Service service = serviceRepo.findOneByModelUUID(relatedInstanceModelVersionId);
+ if(service == null) {
+ service = serviceRepo.findByModelVersionAndModelInvariantUUID(relatedInstanceVersion, relatedInstanceModelInvariantId);
+ }
+
+ if(service == null) {
+ throw new ValidationException("service in relatedInstance");
+ }
+ for (VnfResourceCustomization vnfResourceCustom : service.getVnfCustomizations()) {
+ if (vnfResourceCustom.getModelInstanceName().equals(modelCustomizationName)) {
+ vrc=vnfResourceCustom;
+ }
+ }
+
+ if(vrc != null) {
+ vnfResource = vrc.getVnfResources();
+ modelInfo.setModelCustomizationId(vrc.getModelCustomizationUUID());
+ modelInfo.setModelCustomizationUuid(vrc.getModelCustomizationUUID());
+ }
+ }
+
+ if(vnfResource==null){
+ throw new ValidationException("vnfResource");
+ } else {
+ if(modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(vnfResource.getModelUUID());
+ }
+ }
+
+ VnfRecipe vnfRecipe = null;
+
+ if(vrc != null) {
+ String nfRole = vrc.getNfRole();
+ if(nfRole != null) {
+ vnfRecipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(vrc.getNfRole(), action.toString());
+ }
+ }
+
+ if(vnfRecipe == null) {
+ vnfRecipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
+ }
+
+ if (vnfRecipe == null) {
+ return null;
+ }
+
+ return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
+ } else {
+ /* (v5-v7) 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.
+ // Once the vnfs 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). 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;
+ VnfResource vnfr;
+ VnfResourceCustomization vnfrc;
+ VfModule vfModule = null;
+
+ if(modelInfo.getModelCustomizationId() != null) {
+ vfmc = vfModuleCustomRepo.findByModelCustomizationUUID(modelInfo.getModelCustomizationId());
+ } else {
+ vnfr = vnfRepo.findResourceByModelUUID(relatedInstanceModelVersionId);
+ if(vnfr == null){
+ vnfr = vnfRepo.findResourceByModelInvariantUUIDAndModelVersion(relatedInstanceModelInvariantId, relatedInstanceVersion);
+ }
+ vnfrc = vnfCustomRepo.findByModelInstanceNameAndVnfResources(relatedInstanceModelCustomizationName, vnfr);
+
+ List<VfModuleCustomization> list = vnfrc.getVfModuleCustomizations();
+
+ String vfModuleModelUUID = modelInfo.getModelVersionId();
+ for(VfModuleCustomization vf : list) {
+ VfModuleCustomization vfmCustom;
+ if(vfModuleModelUUID != null){
+ vfmCustom = vfModuleCustomRepo.findByModelCustomizationUUIDAndVfModuleModelUUID(vf.getModelCustomizationUUID(), vfModuleModelUUID);
+ if(vfmCustom != null){
+ vfModule = vfmCustom.getVfModule();
+ }
+ }else{
+ vfmCustom = vfModuleCustomRepo.findByModelCustomizationUUID(vf.getModelCustomizationUUID());
+ if(vfmCustom != null){
+ vfModule = vfmCustom.getVfModule();
+ }else{
+ vfModule = vfModuleRepo.findByModelInvariantUUIDAndModelVersion(relatedInstanceModelInvariantId, relatedInstanceVersion);
+ }
+ }
+
+ if(vfModule != null) {
+ modelInfo.setModelCustomizationId(vf.getModelCustomizationUUID());
+ modelInfo.setModelCustomizationUuid(vf.getModelCustomizationUUID());
+ break;
+ }
+ }
+ }
+
+ if(vfmc == null && vfModule == null) {
+ throw new ValidationException("vfModuleCustomization");
+ } 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 = vnfComponentRecipeRepo.findVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(vfModule.getModelUUID(), vnfComponentType, action.toString());
+ if(recipe == null){
+ List<VfModule> vfModuleRecords= vfModuleRepo.findByModelInvariantUUIDOrderByModelVersionDesc(vfModule.getModelInvariantUUID());
+ if(!vfModuleRecords.isEmpty()){
+ for(VfModule record : vfModuleRecords){
+ recipe = vnfComponentRecipeRepo.findVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(record.getModelUUID(), vnfComponentType, action.toString());
+ if(recipe != null){
+ break;
+ }
+ }
+ }
+ }
+ if(recipe == null) {
+ recipe = vnfComponentRecipeRepo.findVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(defaultSource, vnfComponentType, action.toString());
+ if (recipe == null) {
+ recipe = vnfComponentRecipeRepo.findVnfComponentsRecipeByVnfComponentTypeAndAction(vnfComponentType, action.toString());
+ }
+
+ if(recipe == null) {
+ return null;
+ }
+ }
+ }
+ } else {
+
+ if(modelInfo.getModelType().equals(ModelType.vnf)) {
+ recipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
+ if (recipe == null) {
+ return null;
+ }
+ } else {
+ recipe = vnfComponentRecipeRepo.findVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(defaultSource, vnfComponentType, action.toString());
+
+ if (recipe == null) {
+ return null;
+ }
+ }
+ }
+
+ return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+ }
+
+ private RecipeLookupResult getDefaultVnfUri(ServiceInstancesRequest sir, Actions action) {
+
+ String defaultSource = getDefaultModel(sir);
+
+ VnfRecipe vnfRecipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
+
+ if (vnfRecipe == null) {
+ return null;
+ }
+
+ return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
+ }
+
+
+ private RecipeLookupResult getNetworkUri(ServiceInstancesRequest sir, Actions action) throws ValidationException {
+
+ String defaultNetworkType = getDefaultModel(sir);
+
+ ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
+ String modelName = modelInfo.getModelName();
+ Recipe recipe = null;
+
+ if(modelInfo.getModelCustomizationId()!=null){
+ NetworkResource networkResource = networkCustomizationRepo.findOneByModelCustomizationUUID(modelInfo.getModelCustomizationId()).getNetworkResource();
+ if(networkResource!=null){
+ if(modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(networkResource.getModelUUID());
+ }
+ recipe = networkRecipeRepo.findByModelNameAndAction(networkResource.getModelName(), action.toString());
+ }else{
+ throw new ValidationException("no catalog entry found");
+ }
+ }else{
+ //ok for version < 3 and action delete
+ recipe = networkRecipeRepo.findByModelNameAndAction(modelName, action.toString());
+ }
+
+ if(recipe == null){
+ recipe = networkRecipeRepo.findByModelNameAndAction(defaultNetworkType, action.toString());
+ }
+
+ return recipe !=null ? new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout()) : null;
+ }
+
+ private Optional<String> retrieveModelName(RequestParameters requestParams) {
+ String requestTestApi = null;
+ TestApi testApi = null;
+
+ if (requestParams != null) {
+ requestTestApi = requestParams.getTestApi();
+ }
+
+ if (requestTestApi == null) {
+ if(requestParams != null && requestParams.getALaCarte() != null && !requestParams.getALaCarte()) {
+ requestTestApi = env.getProperty(CommonConstants.MACRO_TEST_API);
+ } else {
+ requestTestApi = env.getProperty(CommonConstants.ALACARTE_TEST_API);
+ }
+ }
+
+ try {
+ testApi = TestApi.valueOf(requestTestApi);
+ return Optional.of(testApi.getModelName());
+ } catch (Exception e) {
+ msoLogger.warnSimple("Catching the exception on the valueOf enum call and continuing", e);
+ throw new IllegalArgumentException("Invalid TestApi is provided", e);
+ }
+ }
+
+ private String getDefaultModel(ServiceInstancesRequest sir) {
+ String defaultModel = sir.getRequestDetails().getRequestInfo().getSource() + "_DEFAULT";
+ Optional<String> oModelName = retrieveModelName(sir.getRequestDetails().getRequestParameters());
+ if (oModelName.isPresent()) {
+ defaultModel = oModelName.get();
+ }
+ return defaultModel;
+ }
+
+ private Response configurationRecipeLookup(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version, String requestId, String requestUri) throws ApiException {
+ String serviceInstanceId = (instanceIdMap ==null)? null:instanceIdMap.get("serviceInstanceId");
+ Boolean aLaCarte = null;
+ String apiVersion = version.substring(1);
+
+ long startTime = System.currentTimeMillis ();
+ ServiceInstancesRequest sir = null;
+
+ sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, sir, msoRequest, requestId, requestUri);
+ String requestScope = deriveRequestScope(action,sir, requestUri);
+ InfraActiveRequests currentActiveReq = msoRequest.createRequestObject ( sir, action, requestId, Status.IN_PROGRESS, requestJSON, requestScope);
+ if(sir.getRequestDetails().getRequestParameters() != null){
+ aLaCarte = sir.getRequestDetails().getRequestParameters().getALaCarte();
+ }
+ parseRequest(sir, instanceIdMap, action, version, requestJSON, aLaCarte, requestId, currentActiveReq);
+ setInstanceId(currentActiveReq, requestScope, null, instanceIdMap);
+ String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
+
+ InfraActiveRequests dup = null;
+
+ dup = duplicateCheck(action, instanceIdMap, startTime, msoRequest, instanceName,requestScope, currentActiveReq);
+
+ if (instanceIdMap != null && dup != null) {
+ buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, startTime, msoRequest, instanceName, requestScope, dup);
+ }
+
+ ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse();
+ RequestReferences referencesResponse = new RequestReferences();
+ referencesResponse.setRequestId(requestId);
+ serviceResponse.setRequestReferences(referencesResponse);
+
+
+ String orchestrationUri = env.getProperty(CommonConstants.ALACARTE_ORCHESTRATION);
+ String timeOut = env.getProperty(CommonConstants.ALACARTE_RECIPE_TIMEOUT);
+
+ 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";
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException = new ValidateException.Builder(error, HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR)
+ .errorInfo(errorLoggerInfo).build();
+
+ msoRequest.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
+
+ throw validateException;
+
+ }
+
+ serviceInstanceId = "";
+ String configurationId = "";
+ String correlationId = "";
+
+ if(sir.getServiceInstanceId () != null){
+ serviceInstanceId = sir.getServiceInstanceId ();
+ }
+
+ if(sir.getConfigurationId() != null){
+ configurationId = sir.getConfigurationId();
+ }
+ if (sir.getCorrelationId() != null) {
+ correlationId = sir.getCorrelationId();
+ }
+ iar.save(currentActiveReq);
+
+ if(!requestScope.equalsIgnoreCase(ModelType.service.name())){
+ aLaCarte = true;
+ }else if(aLaCarte == null){
+ aLaCarte = false;
+ }
+
+ return postBPELRequest(currentActiveReq,action, requestId, startTime, requestJSON, orchestrationUri, Integer.parseInt(timeOut), false,
+ serviceInstanceId, correlationId, null, null, null, null, configurationId, null, null, null, null, apiVersion, aLaCarte, requestUri, null, requestScope, null);
+ }
+
+ public String getRequestId(ContainerRequestContext requestContext) throws ValidateException {
+ String requestId = null;
+ if (requestContext.getProperty("requestId") != null) {
+ requestId = requestContext.getProperty("requestId").toString();
+ }
+ if (UUIDChecker.isValidUUID(requestId)) {
+ return requestId;
+ } else {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ValidateException validateException = new ValidateException.Builder("Request Id " + requestId + " is not a valid UUID", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER)
+ .errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SpringContextHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SpringContextHelper.java
new file mode 100644
index 0000000000..0a996dc3dc
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SpringContextHelper.java
@@ -0,0 +1,41 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SpringContextHelper implements ApplicationContextAware {
+
+ private static ApplicationContext context;
+
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+ context = applicationContext;
+ }
+
+ public static ApplicationContext getAppContext() {
+ return context;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Status.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Status.java
new file mode 100644
index 0000000000..fe9764a2f2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Status.java
@@ -0,0 +1,36 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+
+/*
+ * Enum for Status values returned by API Handler to Tail-F
+*/
+public enum Status {
+ PENDING,
+ IN_PROGRESS,
+ COMPLETE,
+ COMPLETED,
+ FAILED,
+ TIMEOUT,
+ UNLOCKED,
+ PENDING_MANUAL_TASK
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
new file mode 100644
index 0000000000..4900696546
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
@@ -0,0 +1,337 @@
+/*-
+ * ============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.onap.so.apihandlerinfra;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.transaction.Transactional;
+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 javax.ws.rs.core.UriBuilder;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandler.common.RequestClient;
+import org.onap.so.apihandler.common.RequestClientFactory;
+import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandler.common.ResponseHandler;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.tasksbeans.TaskList;
+import org.onap.so.apihandlerinfra.tasksbeans.TaskVariableValue;
+import org.onap.so.apihandlerinfra.tasksbeans.TaskVariables;
+import org.onap.so.apihandlerinfra.tasksbeans.TasksGetResponse;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.utils.UUIDChecker;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+@Path("onap/so/infra/tasks")
+@Api(value="onap/so/infra/tasks",description="Queries of Manual Tasks")
+@Component
+public class TasksHandler {
+
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH,TasksHandler.class);
+
+ @Value("${mso.camunda.rest.task.uri}")
+ private String requestUrl;
+
+ @Autowired
+ private RequestClientFactory reqClientFactory;
+
+ @Autowired
+ private ResponseBuilder builder;
+
+ @Path("/{version:[vV]1}")
+ @GET
+ @ApiOperation(value="Finds Manual Tasks",response=Response.class)
+ @Transactional
+ 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 ApiException {
+ Response responseBack = null;
+
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ MsoLogger.setServiceName ("ManualTasksQuery");
+ // Generate a Request Id
+ UUIDChecker.generateUUID(msoLogger);
+ String apiVersion = version.substring(1);
+
+ // Prepare the query string to /task interface
+ TaskVariables tv = new TaskVariables();
+
+ List<TaskVariableValue> 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;
+
+ HttpResponse response = null;
+
+ try {
+ requestClient = reqClientFactory.getRequestClient(requestUrl);
+ // Capture audit event
+ ObjectMapper mapper = new ObjectMapper();
+ String camundaJsonReq = mapper.writeValueAsString(tv);
+ response = requestClient.post(camundaJsonReq);
+
+ } catch(JsonProcessingException e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ } catch(IOException e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build();
+ AlarmLoggerInfo alarmLoggerInfo = new AlarmLoggerInfo.Builder("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)).build();
+
+
+
+ BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),HttpStatus.SC_BAD_GATEWAY,ErrorNumbers.SVC_NO_SERVER_RESOURCES)
+ .errorInfo(errorLoggerInfo).alarmInfo(alarmLoggerInfo).build();
+
+ throw bpmnFailureException;
+ }
+ TasksGetResponse trr = new TasksGetResponse();
+ List<TaskList> taskList = new ArrayList<>();
+
+ ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ());
+ int bpelStatus = respHandler.getStatus ();
+ if (bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) {
+ String respBody = respHandler.getResponseBody();
+ if (respBody != null) {
+ JSONArray data = new JSONArray(respBody);
+
+ for (int i=0; i<data.length();i++) {
+ JSONObject taskEntry = data.getJSONObject(i);
+ String id = taskEntry.getString("id");
+ if (taskId != null && !taskId.equals(id)) {
+ continue;
+ }
+ // Get variables info for each task ID
+ TaskList taskListEntry = null;
+ taskListEntry = getTaskInfo(id);
+
+ taskList.add(taskListEntry);
+
+ }
+ trr.setTaskList(taskList);
+ }
+
+ } else {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+
+
+ BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
+ .errorInfo(errorLoggerInfo).build();
+
+ throw bpmnFailureException;
+ }
+
+ String jsonResponse = null;
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ jsonResponse = mapper.writeValueAsString(trr);
+ }
+ catch (JsonProcessingException e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+
+ return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, jsonResponse, apiVersion);
+ }
+
+ protected MsoLogger getMsoLogger () {
+ return msoLogger;
+ }
+
+ // Makes a GET call to Camunda to get variables for this task
+ private TaskList getTaskInfo(String taskId) throws ApiException{
+ TaskList taskList;
+ String getRequestUrl = UriBuilder.fromUri(requestUrl).path(taskId).path("variables").build().toString();
+ HttpResponse getResponse;
+
+ RequestClient requestClient = reqClientFactory.getRequestClient (getRequestUrl);
+ // Capture audit event
+ try {
+ getResponse = requestClient.get();
+ }catch(IOException e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build();
+ AlarmLoggerInfo alarmLoggerInfo = new AlarmLoggerInfo.Builder("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL, Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)).build();
+
+
+
+ BPMNFailureException validateException = new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY), HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES)
+ .errorInfo(errorLoggerInfo).alarmInfo(alarmLoggerInfo).build();
+ throw validateException;
+ }
+ ResponseHandler respHandler = new ResponseHandler (getResponse, requestClient.getType ());
+ int bpelStatus = respHandler.getStatus ();
+ if (bpelStatus == HttpStatus.SC_ACCEPTED) {
+ String respBody = respHandler.getResponseBody();
+ if (respBody != null) {
+ taskList = buildTaskList(taskId, respBody);
+ }
+ else {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build();
+ AlarmLoggerInfo alarmLoggerInfo = new AlarmLoggerInfo.Builder("MsoConfigurationError", MsoAlarmLogger.CRITICAL, Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)).build();
+
+
+
+ BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY), HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES)
+ .errorInfo(errorLoggerInfo).alarmInfo(alarmLoggerInfo).build();
+ throw bpmnFailureException;
+ }
+
+ }
+ else {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build();
+ AlarmLoggerInfo alarmLoggerInfo = new AlarmLoggerInfo.Builder("MsoConfigurationError", MsoAlarmLogger.CRITICAL, Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)).build();
+
+
+
+ BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus, ErrorNumbers.SVC_NO_SERVER_RESOURCES)
+ .errorInfo(errorLoggerInfo).alarmInfo(alarmLoggerInfo).build();
+
+ throw bpmnFailureException;
+ }
+
+ return taskList;
+
+ }
+
+ private TaskList buildTaskList(String taskId, String respBody) throws JSONException {
+ TaskList taskList = new TaskList();
+ JSONObject variables = new JSONObject(respBody);
+
+ taskList.setTaskId(taskId);
+ taskList.setType(getOptVariableValue(variables, "type"));
+ taskList.setNfRole(getOptVariableValue(variables, "nfRole"));
+ taskList.setSubscriptionServiceType(getOptVariableValue(variables, "subscriptionServiceType"));
+ taskList.setOriginalRequestId(getOptVariableValue(variables, "originalRequestId"));
+ taskList.setOriginalRequestorId(getOptVariableValue(variables, "originalRequestorId"));
+ taskList.setErrorSource(getOptVariableValue(variables, "errorSource"));
+ taskList.setErrorCode(getOptVariableValue(variables, "errorCode"));
+ taskList.setErrorMessage(getOptVariableValue(variables, "errorMessage"));
+ taskList.setBuildingBlockName(getOptVariableValue(variables, "buildingBlockName"));
+ taskList.setBuildingBlockStep(getOptVariableValue(variables, "buildingBlockStep"));
+
+ String validResponses = getOptVariableValue(variables, "validResponses").toLowerCase();
+ List<String> items = Arrays.asList(validResponses.split("\\s*,\\s*"));
+ taskList.setValidResponses(items);
+
+ return taskList;
+ }
+
+ private String getOptVariableValue(JSONObject variables, String name) throws JSONException {
+ String variableEntry = variables.optString(name);
+ String value = "";
+ if (!variableEntry.isEmpty()) {
+ JSONObject variableEntryJson = new JSONObject(variableEntry);
+ value = variableEntryJson.optString("value");
+ }
+ return value;
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TestApi.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TestApi.java
new file mode 100644
index 0000000000..d2e96562ea
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TestApi.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.apihandlerinfra;
+
+public enum TestApi {
+ GR_API("GR-API-DEFAULT"),
+ VNF_API("VNF-API-DEFAULT");
+
+ private final String modelName;
+
+ private TestApi(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java
new file mode 100644
index 0000000000..aca0fa511e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.apihandlerinfra;
+
+import org.onap.so.security.MSOSpringFirewall;
+import org.onap.so.security.WebSecurityConfig;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.annotation.Order;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.web.firewall.StrictHttpFirewall;
+import org.springframework.util.StringUtils;
+
+@EnableWebSecurity
+@Configuration("att-security-config")
+@Order(2)
+public class WebSecurityConfigImpl extends WebSecurityConfig {
+
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.csrf().disable()
+ .authorizeRequests()
+ .antMatchers("/manage/health","/manage/info").permitAll()
+ .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString())
+ .and()
+ .httpBasic();
+
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ super.configure(web);
+ StrictHttpFirewall firewall = new MSOSpringFirewall();
+ web.httpFirewall(firewall);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/CatalogDBConfig.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/CatalogDBConfig.java
new file mode 100644
index 0000000000..f7d719048f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/CatalogDBConfig.java
@@ -0,0 +1,80 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.configuration;
+
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(
+ entityManagerFactoryRef = "entityManagerFactory",
+ basePackages = {"org.onap.so.db.catalog.data.repository"}
+ )
+@Profile({"!test"})
+public class CatalogDBConfig {
+
+ @Primary
+ @Bean(name = "dataSource")
+ @ConfigurationProperties(prefix = "spring.datasource")
+ public DataSource dataSource() {
+ return DataSourceBuilder.create().build();
+ }
+
+ @Primary
+ @Bean(name = "entityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean
+ entityManagerFactory(
+ EntityManagerFactoryBuilder builder,
+ @Qualifier("dataSource") DataSource dataSource
+ ) {
+ return builder
+ .dataSource(dataSource)
+ .packages("org.onap.so.db.catalog.beans")
+ .persistenceUnit("catalogDB")
+ .build();
+ }
+
+ @Primary
+ @Bean(name = "transactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("entityManagerFactory") EntityManagerFactory
+ entityManagerFactory
+ ) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/RequestDBConfig.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/RequestDBConfig.java
new file mode 100644
index 0000000000..2298ccdb26
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/RequestDBConfig.java
@@ -0,0 +1,78 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.configuration;
+
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(
+ entityManagerFactoryRef = "requestEntityManagerFactory",transactionManagerRef = "requestTransactionManager",
+ basePackages = { "org.onap.so.db.request.data.repository"}
+ )
+@Profile({"!test"})
+public class RequestDBConfig {
+
+ @Bean(name = "requestDataSource")
+ @ConfigurationProperties(prefix = "request.datasource")
+ public DataSource dataSource() {
+ return DataSourceBuilder.create().build();
+ }
+
+
+ @Bean(name = "requestEntityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean
+ entityManagerFactory(
+ EntityManagerFactoryBuilder builder,
+ @Qualifier("requestDataSource") DataSource dataSource
+ ) {
+ return builder
+ .dataSource(dataSource)
+ .packages("org.onap.so.db.request.beans")
+ .persistenceUnit("requestDB")
+ .build();
+ }
+
+
+ @Bean(name = "requestTransactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("requestEntityManagerFactory") EntityManagerFactory
+ entityManagerFactory
+ ) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/CompareModelsRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/CompareModelsRequest.java
new file mode 100644
index 0000000000..89482f7879
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/CompareModelsRequest.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 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.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT)
+public class CompareModelsRequest {
+
+ private String globalSubscriberId;
+
+ private String serviceType;
+
+ private String modelInvariantIdTarget;
+
+ private String modelVersionIdTarget;
+
+
+ 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 getModelInvariantIdTarget() {
+ return modelInvariantIdTarget;
+ }
+
+ public void setModelInvariantIdTarget(String modelInvariantIdTarget) {
+ this.modelInvariantIdTarget = modelInvariantIdTarget;
+ }
+
+ public String getModelVersionIdTarget() {
+ return modelVersionIdTarget;
+ }
+
+ public void setModelVersionIdTarget(String modelVersionIdTarget) {
+ this.modelVersionIdTarget = modelVersionIdTarget;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/DelE2ESvcResp.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/DelE2ESvcResp.java
new file mode 100644
index 0000000000..a2b410f57f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/DelE2ESvcResp.java
@@ -0,0 +1,37 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT)
+public class DelE2ESvcResp {
+
+ private String operationId;
+
+ public String getOperationId() {
+ return operationId;
+ }
+
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EParameters.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EParameters.java
new file mode 100644
index 0000000000..6dfa4b6587
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EParameters.java
@@ -0,0 +1,83 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@JsonIgnoreProperties({ "additionalProperties" })
+public class E2EParameters {
+
+ @JsonProperty("locationConstraints")
+ List<LocationConstraint> locationConstraints;
+
+ @JsonProperty("resources")
+ private List<ResourceRequest> resources;
+
+ @JsonProperty("requestInputs")
+ private HashMap<String, ?> requestInputs;
+
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ public Map<String, Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+ /**
+ * @return Returns the resources.
+ */
+ public List<ResourceRequest> getResources() {
+ return resources;
+ }
+
+ /**
+ * @param resources The resources to set.
+ */
+ public void setResources(List<ResourceRequest> resources) {
+ this.resources = resources;
+ }
+
+ public List<LocationConstraint> getLocationConstraints() {
+ return locationConstraints;
+ }
+
+ public void setLocationConstraints(List<LocationConstraint> locationConstraints) {
+ this.locationConstraints = locationConstraints;
+ }
+
+ public HashMap<String, ?> getRequestInputs() {
+ return requestInputs;
+ }
+
+ public void setRequestInputs(HashMap<String, ?> requestInputs) {
+ this.requestInputs = requestInputs;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java
new file mode 100644
index 0000000000..dfe94dd2f0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java
@@ -0,0 +1,113 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java
new file mode 100644
index 0000000000..9f6a9b438c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java
@@ -0,0 +1,120 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@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<String, Object> 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<String, Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties(Map<String, Object> 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/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java
new file mode 100644
index 0000000000..a920bdfdc8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java
@@ -0,0 +1,46 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java
new file mode 100644
index 0000000000..e3edf3b742
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java
@@ -0,0 +1,61 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties({ "additionalProperties" })
+public class E2EServiceInstanceRequest {
+
+ @JsonProperty("service")
+ private E2EService service;
+
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ public E2EService getService() {
+ return service;
+ }
+
+ public void setService(E2EService service) {
+ this.service = service;
+ }
+
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+
+
+ public void setAdditionalProperties(Map<String, Object> 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/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java
new file mode 100644
index 0000000000..f7cdd7ab04
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java
@@ -0,0 +1,35 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java
new file mode 100644
index 0000000000..531824e379
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java
@@ -0,0 +1,69 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class E2EUserParam {
+
+ @JsonProperty("name")
+ private String name;
+
+ @JsonProperty("value")
+ private String value;
+
+ @JsonIgnore
+ private Map<String, Object> 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<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java
new file mode 100644
index 0000000000..45aa5e24db
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+
+import org.onap.so.db.request.beans.OperationStatus;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+@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/onap/so/apihandlerinfra/e2eserviceinstancebeans/LocationConstraint.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/LocationConstraint.java
new file mode 100644
index 0000000000..b1256a236b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/LocationConstraint.java
@@ -0,0 +1,76 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @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/onap/so/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java
new file mode 100644
index 0000000000..e7baf98411
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java
@@ -0,0 +1,68 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-6
+ */
+public class NsParameters {
+
+ private List<LocationConstraint> locationConstraints;
+
+ private Map<String, Object> additionalParamForNs = new HashMap<>();
+ /**
+ * @return Returns the locationConstraints.
+ */
+ public List<LocationConstraint> getLocationConstraints() {
+ return locationConstraints;
+ }
+
+ /**
+ * @param locationConstraints The locationConstraints to set.
+ */
+ public void setLocationConstraints(List<LocationConstraint> locationConstraints) {
+ this.locationConstraints = locationConstraints;
+ }
+
+
+ /**
+ * @return Returns the additionalParamForNs.
+ */
+ public Map<String, Object> getAdditionalParamForNs() {
+ return additionalParamForNs;
+ }
+
+
+ /**
+ * @param additionalParamForNs The additionalParamForNs to set.
+ */
+ public void setAdditionalParamForNs(Map<String, Object> additionalParamForNs) {
+ this.additionalParamForNs = additionalParamForNs;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java
new file mode 100644
index 0000000000..6518523256
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java
@@ -0,0 +1,102 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.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<String, Object> 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<String, Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties(Map<String, Object> 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/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java
new file mode 100644
index 0000000000..0744028dbf
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java
new file mode 100644
index 0000000000..ebb8ab8dcb
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java
@@ -0,0 +1,34 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java
new file mode 100644
index 0000000000..3a906bcb4b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java
new file mode 100644
index 0000000000..3b6ec58d8c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java
@@ -0,0 +1,66 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.util.List;
+
+public class ScaleService {
+
+ private String serviceInstanceName;
+
+ private String serviceType;
+
+ private String globalSubscriberId;
+
+ private List<ScaleResource> 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<ScaleResource> getResources() {
+ return resources;
+ }
+
+ public void setResources(List<ScaleResource> resources) {
+ this.resources = resources;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/VimLocation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/VimLocation.java
new file mode 100644
index 0000000000..72d370425f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/VimLocation.java
@@ -0,0 +1,45 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+
+import com.fasterxml.jackson.annotation.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/onap/so/apihandlerinfra/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/package-info.java
new file mode 100644
index 0000000000..2312678460
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/package-info.java
@@ -0,0 +1,30 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap/so/request/types/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.onap.so.apihandlerinfra;
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/RequestDetails.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/RequestDetails.java
new file mode 100644
index 0000000000..957450fab0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/RequestDetails.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tasksbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/RequestInfo.java
new file mode 100644
index 0000000000..aae8786bb0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/RequestInfo.java
@@ -0,0 +1,73 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tasksbeans/TaskList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskList.java
new file mode 100644
index 0000000000..b88521f813
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskList.java
@@ -0,0 +1,333 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tasksbeans;
+
+import java.util.List;
+
+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 List<String> 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 List<String> getValidResponses() {
+ return validResponses;
+ }
+
+ /**
+ * Sets the value of the validResponses property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ValidResponses }
+ *
+ */
+ public void setValidResponses(List<String> value) {
+ this.validResponses = value;
+ }
+
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskRequestReference.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskRequestReference.java
new file mode 100644
index 0000000000..860fe6bddb
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskRequestReference.java
@@ -0,0 +1,56 @@
+/* ============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.onap.so.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/onap/so/apihandlerinfra/tasksbeans/TaskVariableValue.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariableValue.java
new file mode 100644
index 0000000000..441d4f315a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariableValue.java
@@ -0,0 +1,107 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tasksbeans/TaskVariables.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariables.java
new file mode 100644
index 0000000000..7d5b465891
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariables.java
@@ -0,0 +1,39 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tasksbeans;
+
+import java.util.List;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class TaskVariables {
+
+ private List<TaskVariableValue> taskVariables;
+
+ public List<TaskVariableValue> getTaskVariables() {
+ return taskVariables;
+ }
+
+ public void setTaskVariables(List<TaskVariableValue> taskVariables) {
+ this.taskVariables = taskVariables;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TasksGetResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TasksGetResponse.java
new file mode 100644
index 0000000000..5ee01aeaf6
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TasksGetResponse.java
@@ -0,0 +1,36 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tasksbeans;
+
+import java.util.List;
+
+public class TasksGetResponse {
+
+ private List<TaskList> taskList;
+
+ public List<TaskList> getTaskList() {
+ return taskList;
+ }
+
+ public void setTaskList(List<TaskList> taskList) {
+ this.taskList = taskList;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TasksRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TasksRequest.java
new file mode 100644
index 0000000000..0544f536a2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TasksRequest.java
@@ -0,0 +1,34 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tasksbeans/ValidResponses.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/ValidResponses.java
new file mode 100644
index 0000000000..977e7c4f2e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/ValidResponses.java
@@ -0,0 +1,52 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.apihandlerinfra.tasksbeans;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+
+public enum ValidResponses {
+
+ rollback,
+ abort,
+ skip,
+ retry,
+ manual
+ ;
+
+ 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/onap/so/apihandlerinfra/tasksbeans/Value.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/Value.java
new file mode 100644
index 0000000000..98ed5b653f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/Value.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tasksbeans/Variables.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/Variables.java
new file mode 100644
index 0000000000..1ed011db91
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/Variables.java
@@ -0,0 +1,74 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java
new file mode 100644
index 0000000000..5675588f62
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java
@@ -0,0 +1,68 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.onap.so.apihandlerinfra.SpringContextHelper;
+import org.onap.so.client.aai.AAIProperties;
+import org.onap.so.client.aai.AAIVersion;
+import org.springframework.context.ApplicationContext;
+
+public class AaiClientPropertiesImpl implements AAIProperties {
+
+ private String aaiEndpoint;
+ private String auth;
+ private String key;
+ public AaiClientPropertiesImpl() {
+
+ ApplicationContext context = SpringContextHelper.getAppContext();
+ aaiEndpoint = context.getEnvironment().getProperty("mso.aai.endpoint");
+ this.auth = context.getEnvironment().getProperty("aai.auth");
+ this.key = context.getEnvironment().getProperty("mso.msoKey");
+ }
+
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return new URL(aaiEndpoint);
+ }
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
+ }
+
+ @Override
+ public AAIVersion getDefaultVersion() {
+ return AAIVersion.LATEST;
+ }
+
+ @Override
+ public String getAuth() {
+ return this.auth;
+ }
+
+ @Override
+ public String getKey() {
+ return this.key;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
new file mode 100644
index 0000000000..dd1f19ff62
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
@@ -0,0 +1,238 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation;
+
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+
+import javax.inject.Provider;
+import javax.transaction.Transactional;
+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.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.http.HttpStatus;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.Status;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestReferences;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.TenantSyncResponse;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.utils.UUIDChecker;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+@Component
+@Path("/onap/so/infra/cloudResources")
+@Api(value="/onap/so/infra/cloudResources",description="API Requests for cloud resources - Tenant Isolation")
+public class CloudOrchestration {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, CloudOrchestration.class);
+ private static final String ENVIRONMENT_ID_KEY = "operationalEnvironmentId";
+
+ @Autowired
+ private TenantIsolationRequest tenantIsolationRequest ;
+ @Autowired
+ private InfraActiveRequestsRepository iarRepo;
+ @Autowired
+ private Provider<TenantIsolationRunnable> tenantIsolationRunnable;
+
+ @POST
+ @Path("/{version:[vV][1]}/operationalEnvironments")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Create an Operational Environment",response=Response.class)
+ @Transactional
+ public Response createOperationEnvironment(String request, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException{
+ msoLogger.debug("Received request to Create Operational Environment");
+ return cloudOrchestration(request, Action.create, null, version, getRequestId(requestContext));
+ }
+
+ @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)
+ @Transactional
+ public Response activateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId,
+ @Context ContainerRequestContext requestContext) throws ApiException{
+ msoLogger.debug("Received request to Activate an Operational Environment");
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put(ENVIRONMENT_ID_KEY, operationalEnvironmentId);
+ return cloudOrchestration(request, Action.activate, instanceIdMap, version, getRequestId(requestContext));
+ }
+
+ @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)
+ @Transactional
+ public Response deactivateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId, @Context ContainerRequestContext requestContext) throws ApiException{
+ msoLogger.debug("Received request to Deactivate an Operational Environment");
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put(ENVIRONMENT_ID_KEY, operationalEnvironmentId);
+ return cloudOrchestration(request, Action.deactivate, instanceIdMap, version, getRequestId(requestContext));
+ }
+
+
+ private Response cloudOrchestration(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version, String requestId) throws ApiException{
+ MsoLogger.setLogContext(requestId, null);
+ msoLogger.info(MessageEnum.APIH_GENERATED_REQUEST_ID, requestId, "", "");
+ long startTime = System.currentTimeMillis ();
+ CloudOrchestrationRequest cor = null;
+ tenantIsolationRequest.setRequestId(requestId);
+
+ cor = convertJsonToCloudOrchestrationRequest(requestJSON, action, startTime, cor);
+
+ try {
+ tenantIsolationRequest.parse(cor, instanceIdMap, action);
+ }catch(ValidationException e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+
+
+ throw new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER)
+ .cause(e).errorInfo(errorLoggerInfo).build();
+ }
+
+ String instanceName = cor.getRequestDetails().getRequestInfo().getInstanceName();
+ String resourceType = cor.getRequestDetails().getRequestInfo().getResourceType().name();
+ InfraActiveRequests dup = null;
+
+ dup = duplicateCheck(action, instanceIdMap, startTime, instanceName, resourceType);
+
+ if(dup == null && (Action.activate.equals(action) || Action.deactivate.equals(action))) {
+ dup = iarRepo.checkVnfIdStatus(cor.getOperationalEnvironmentId());
+ }
+
+ if(dup != null) {
+ String instance = null;
+ if(instanceName != null){
+ instance = instanceName;
+ }else if (instanceIdMap != null){
+ instance = instanceIdMap.get(resourceType + "InstanceId");
+ }
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, MsoLogger.ErrorCode.SchemaError).build();
+
+
+ throw new DuplicateRequestException.Builder(resourceType,instance,dup.getRequestStatus(),dup.getRequestId(), HttpStatus.SC_CONFLICT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
+ .errorInfo(errorLoggerInfo).build();
+ }
+
+ String instanceId = null;
+
+ if(instanceIdMap != null && instanceIdMap.get(ENVIRONMENT_ID_KEY) != null) {
+ instanceId = instanceIdMap.get(ENVIRONMENT_ID_KEY);
+ } else {
+ instanceId = UUIDChecker.generateUUID(msoLogger);
+ tenantIsolationRequest.setOperationalEnvironmentId(instanceId);
+ cor.setOperationalEnvironmentId(instanceId);
+ }
+
+ tenantIsolationRequest.createRequestRecord(Status.IN_PROGRESS, action);
+
+ OperationalEnvironment opEnv = cor.getRequestDetails().getRequestParameters().getOperationalEnvironmentType();
+ String operationalEnvType = opEnv != null ? opEnv.name() : null;
+
+ TenantIsolationRunnable runnable = tenantIsolationRunnable.get();
+ runnable.run(action, operationalEnvType, cor, requestId);
+
+ String encodedValue;
+ try {
+ encodedValue = new String(instanceId.getBytes("UTF-8"));
+ } catch(UnsupportedEncodingException ex) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.DataError).build();
+
+
+ throw new ValidateException.Builder("Could not encode instanceID" + ex.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER)
+ .cause(ex).errorInfo(errorLoggerInfo).build();
+ }
+
+ TenantSyncResponse tenantResponse = new TenantSyncResponse();
+ RequestReferences reqReference = new RequestReferences();
+ reqReference.setInstanceId(encodedValue);
+ reqReference.setRequestId(requestId);
+ tenantResponse.setRequestReferences(reqReference);
+
+ return Response.ok(tenantResponse).build();
+ }
+
+ private InfraActiveRequests duplicateCheck(Action action, HashMap<String, String> instanceIdMap, long startTime,
+ String instanceName, String requestScope) throws ApiException {
+ try {
+ return iarRepo.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
+ } catch (Exception e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ throw new ValidateException.Builder("Duplicate Check Request", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ }
+ }
+
+ private CloudOrchestrationRequest convertJsonToCloudOrchestrationRequest(String requestJSON, Action action, long startTime,
+ CloudOrchestrationRequest cor) throws ApiException {
+ try{
+ msoLogger.debug("Converting incoming JSON request to Object");
+ ObjectMapper mapper = new ObjectMapper();
+ return mapper.readValue(requestJSON, CloudOrchestrationRequest.class);
+ } catch(IOException e){
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
+ .cause(e).errorInfo(errorLoggerInfo).build();
+ if (tenantIsolationRequest.getRequestId () != null) {
+ tenantIsolationRequest.createRequestRecord (Status.FAILED, action);
+ }
+ throw validateException;
+ }
+ }
+
+ private String getRequestId(ContainerRequestContext requestContext) {
+ return requestContext.getProperty("requestId").toString();
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java
new file mode 100644
index 0000000000..d387928e22
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java
@@ -0,0 +1,81 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation;
+
+import java.io.Serializable;
+
+import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
+import org.onap.so.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/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
new file mode 100644
index 0000000000..a3835f1551
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
@@ -0,0 +1,297 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.transaction.Transactional;
+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.HttpHeaders;
+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 org.onap.so.apihandler.common.CommonConstants;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.Messages;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.CloudOrchestrationRequestList;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.CloudOrchestrationResponse;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.InstanceReferences;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.Request;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestDetails;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestStatus;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.utils.UUIDChecker;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Component
+@Path("onap/so/infra/cloudResourcesRequests")
+@Api(value="onap/so/infra/cloudResourcesRequests",description="API GET Requests for cloud resources - Tenant Isolation")
+public class CloudResourcesOrchestration {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, CloudResourcesOrchestration.class);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ @Autowired
+ private InfraActiveRequestsRepository iarRepo;
+ @Autowired
+ private InfraActiveRequestsRepository infraActiveRequestsRepository;
+ @Autowired
+ private ResponseBuilder builder;
+
+ @POST
+ @Path("/{version: [vV][1]}/{requestId}/unlock")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Unlock CloudOrchestration requests for a specified requestId")
+ @Transactional
+ public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) throws ApiException{
+ TenantIsolationRequest msoRequest = new TenantIsolationRequest(requestId);
+ InfraActiveRequests infraActiveRequest = null;
+
+ CloudOrchestrationRequest cor = null;
+
+ msoLogger.debug ("requestId is: " + requestId);
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ cor = mapper.readValue(requestJSON, CloudOrchestrationRequest.class);
+ } catch(IOException e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+
+ ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
+ .cause(e).errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+
+ try{
+ msoRequest.parseOrchestration(cor);
+ } catch (ValidationException e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
+ .cause(e).errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+ try {
+ infraActiveRequest = infraActiveRequestsRepository.findOneByRequestIdOrClientRequestId(requestId, requestId);
+ }catch(Exception e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.AvailabilityError).build();
+ AlarmLoggerInfo alarmLoggerInfo = new AlarmLoggerInfo.Builder("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
+ Messages.getErrors().get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)).build();
+ ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).alarmInfo(alarmLoggerInfo).build();
+
+ throw validateException;
+ }
+ if(infraActiveRequest == null) {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB", HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
+ .errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+
+ }else{
+ String status = infraActiveRequest.getRequestStatus();
+ if(status.equalsIgnoreCase("IN_PROGRESS") || status.equalsIgnoreCase("PENDING") || status.equalsIgnoreCase("PENDING_MANUAL_TASK")){
+ infraActiveRequest.setRequestStatus("UNLOCKED");
+ infraActiveRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ infraActiveRequestsRepository.save(infraActiveRequest);
+ }else{
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,MsoLogger.ErrorCode.DataError).build();
+ ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked",
+ HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+ }
+
+ 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)
+ @Transactional
+ public Response getOperationEnvironmentStatusFilter(@Context UriInfo ui, @PathParam("version") String version ) throws ApiException{
+ MsoLogger.setServiceName ("getOperationEnvironmentStatusFilter");
+ UUIDChecker.generateUUID(msoLogger);
+
+ MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+ List<String> requestIdKey = queryParams.get("requestId");
+ String apiVersion = version.substring(1);
+
+ if(queryParams.size() == 1 && requestIdKey != null) {
+ String requestId = requestIdKey.get(0);
+
+ CloudOrchestrationResponse cloudOrchestrationGetResponse = new CloudOrchestrationResponse();
+ TenantIsolationRequest tenantIsolationRequest = new TenantIsolationRequest (requestId);
+ InfraActiveRequests requestDB = null;
+
+ try {
+ requestDB = infraActiveRequestsRepository.findOneByRequestIdOrClientRequestId(requestId, requestId);
+ } catch (Exception e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.AvailabilityError).build();
+ AlarmLoggerInfo alarmLoggerInfo = new AlarmLoggerInfo.Builder("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
+ Messages.getErrors().get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)).build();
+ ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).alarmInfo(alarmLoggerInfo).build();
+
+ throw validateException;
+ // TODO Will need to set Status for tenantIsolationRequest
+ // tenantIsolationRequest.setStatus (org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ }
+
+ if(requestDB == null) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB",
+ HttpStatus.SC_NO_CONTENT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
+ .errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+
+ Request request = mapInfraActiveRequestToRequest(requestDB);
+ cloudOrchestrationGetResponse.setRequest(request);
+ return builder.buildResponse(HttpStatus.SC_OK, requestId, cloudOrchestrationGetResponse, apiVersion);
+
+ } else {
+ TenantIsolationRequest tenantIsolationRequest = new TenantIsolationRequest ();
+ List<InfraActiveRequests> activeRequests = null;
+ CloudOrchestrationRequestList orchestrationList = null;
+
+
+ Map<String, String> orchestrationMap;
+ try{
+ orchestrationMap = tenantIsolationRequest.getOrchestrationFilters(queryParams);
+ }catch(ValidationException ex){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ValidateException validateException = new ValidateException.Builder(ex.getMessage(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).cause(ex)
+ .errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+
+ }
+ activeRequests = iarRepo.getCloudOrchestrationFiltersFromInfraActive(orchestrationMap);
+ orchestrationList = new CloudOrchestrationRequestList();
+ List<CloudOrchestrationResponse> requestLists = new ArrayList<CloudOrchestrationResponse>();
+
+ for(InfraActiveRequests infraActive : activeRequests){
+
+ Request request = mapInfraActiveRequestToRequest(infraActive);
+ CloudOrchestrationResponse requestList = new CloudOrchestrationResponse();
+ requestList.setRequest(request);
+ requestLists.add(requestList);
+ }
+ orchestrationList.setRequestList(requestLists);
+
+ return builder.buildResponse(HttpStatus.SC_OK, null, orchestrationList, apiVersion);
+ }
+ }
+
+ private Request mapInfraActiveRequestToRequest(InfraActiveRequests iar) throws ApiException {
+ Request request = new Request();
+ request.setRequestId(iar.getRequestId());
+ request.setRequestScope(iar.getRequestScope());
+ request.setRequestType(iar.getRequestAction());
+
+ InstanceReferences ir = new InstanceReferences();
+
+ if(iar.getOperationalEnvId() != null)
+ ir.setOperationalEnvironmentId(iar.getOperationalEnvId());
+ if(iar.getOperationalEnvName() != null)
+ ir.setOperationalEnvName(iar.getOperationalEnvName());
+ if(iar.getRequestorId() != null)
+ ir.setRequestorId(iar.getRequestorId());
+
+ request.setInstanceReferences(ir);
+ String requestBody = iar.getRequestBody();
+ RequestDetails requestDetails = null;
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ requestDetails = mapper.readValue(requestBody, RequestDetails.class);
+ }catch(IOException e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
+ .cause(e).errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+
+ request.setRequestDetails(requestDetails);
+ String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(iar.getStartTime()) + " GMT";
+ request.setStartTime(startTimeStamp);
+
+ RequestStatus status = new RequestStatus();
+ if(iar.getStatusMessage() != null){
+ status.setStatusMessage(iar.getStatusMessage());
+ }
+
+ if(iar.getEndTime() != null){
+ String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(iar.getEndTime()) + " GMT";
+ status.setTimeStamp(endTimeStamp);
+ }
+
+ if(iar.getRequestStatus() != null){
+ status.setRequestState(iar.getRequestStatus());
+ }
+
+ if(iar.getProgress() != null){
+ status.setPercentProgress(iar.getProgress().toString());
+ }
+
+ request.setRequestStatus(status);
+
+ return request;
+ }
+
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java
new file mode 100644
index 0000000000..58a7cb2bff
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java
@@ -0,0 +1,76 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.ws.rs.core.MediaType;
+
+import org.onap.so.apihandlerinfra.SpringContextHelper;
+import org.onap.so.client.grm.GRMProperties;
+import org.springframework.context.ApplicationContext;
+
+public class GrmClientPropertiesImpl implements GRMProperties {
+
+ private String grmEndpoint;
+ private String grmUsername;
+ private String grmPassword;
+
+ public GrmClientPropertiesImpl() {
+ ApplicationContext context = SpringContextHelper.getAppContext();
+
+ grmEndpoint = context.getEnvironment().getProperty("mso.grm.endpoint");
+ grmUsername = context.getEnvironment().getProperty("mso.grm.username");
+ grmPassword = context.getEnvironment().getProperty("mso.grm.password");
+ }
+
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return new URL(grmEndpoint);
+ }
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
+ }
+
+ @Override
+ public String getDefaultVersion() {
+ return "v1";
+ }
+
+ @Override
+ public String getUsername() {
+ return grmUsername;
+ }
+
+ @Override
+ public String getPassword() {
+ return grmPassword;
+ }
+
+ @Override
+ public String getContentType() {
+ return MediaType.APPLICATION_JSON;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
new file mode 100644
index 0000000000..e75d56e7d3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
@@ -0,0 +1,156 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.inject.Provider;
+import javax.transaction.Transactional;
+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.commons.lang3.StringUtils;
+import org.apache.http.HttpStatus;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.MsoException;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.Status;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.ServiceException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+
+@Path("/onap/so/infra/modelDistributions")
+@Api(value="/onap/so/infra/modelDistributions",description="API Requests for Model Distributions")
+public class ModelDistributionRequest {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, ModelDistributionRequest.class);
+ @Autowired
+ private Provider<TenantIsolationRunnable> tenantIsolationRunnable;
+
+ @POST
+ @Path("/{version:[vV][1]}/distributions/{distributionId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Update model distribution status",response=Response.class)
+ @Transactional
+ public Response updateModelDistributionStatus(String requestJSON, @PathParam("version") String version, @PathParam("distributionId") String distributionId) throws ApiException{
+ long startTime = System.currentTimeMillis ();
+ Distribution distributionRequest = null;
+
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ distributionRequest = mapper.readValue(requestJSON, Distribution.class);
+ } catch(IOException e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
+ .cause(e).errorInfo(errorLoggerInfo).build();
+ throw validateException;
+
+ }
+
+ try {
+ parse(distributionRequest);
+ } catch(ValidationException e) {
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
+ .cause(e).errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+
+ CloudOrchestrationRequest cor = new CloudOrchestrationRequest();
+ cor.setDistribution(distributionRequest);
+ cor.setDistributionId(distributionId);
+
+ TenantIsolationRunnable runnable = tenantIsolationRunnable.get();
+ runnable.run(Action.distributionStatus, null, cor, null);
+
+ 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<String> variables) throws ApiException{
+ 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(JsonProcessingException e){
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR,MsoLogger.ErrorCode.DataError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
+ .cause(e).errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+
+ return Response.status (httpResponseCode).entity(requestErrorStr).build ();
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
new file mode 100644
index 0000000000..a6452a44ac
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
@@ -0,0 +1,461 @@
+/*-
+ * ============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.onap.so.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.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.MsoException;
+import org.onap.so.apihandlerinfra.Status;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.Manifest;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.RelatedInstance;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.RelatedInstanceList;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestDetails;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestInfo;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.ResourceType;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.ServiceModelList;
+import org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.serviceinstancebeans.PolicyException;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.ServiceException;
+import org.onap.so.utils.UUIDChecker;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+@Scope("prototype")
+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 String operationalEnvironmentId;
+ private long progress = Constants.PROGRESS_REQUEST_RECEIVED;
+ private String requestScope;
+ private CloudOrchestrationRequest cor;
+
+ @Autowired
+ private InfraActiveRequestsRepository infraActiveRequestsRepository;
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, TenantIsolationRequest.class);
+
+
+ TenantIsolationRequest (String requestId) {
+ this.requestId = requestId;
+ MsoLogger.setLogContext (requestId, null);
+ }
+
+ TenantIsolationRequest () {
+ MsoLogger.setLogContext (requestId, null);
+ }
+
+ void parse(CloudOrchestrationRequest request, HashMap<String,String> instanceIdMap, Action action) throws ValidationException {
+ this.cor = request;
+ this.requestInfo = request.getRequestDetails().getRequestInfo();
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ requestJSON = mapper.writeValueAsString(request.getRequestDetails());
+
+ } catch(JsonProcessingException e){
+ throw new ValidationException ("Parse ServiceInstanceRequest to JSON string", true);
+ }
+
+ String envId = null;
+ if(instanceIdMap != null) {
+ envId = instanceIdMap.get("operationalEnvironmentId");
+ if(envId != null && !UUIDChecker.isValidUUID (envId)){
+ throw new ValidationException ("operationalEnvironmentId", true);
+ }
+ 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 (requestParameters == null) {
+ throw new ValidationException("requestParameters", true);
+ }
+ if((Action.activate.equals(action) || Action.deactivate.equals(action)) && OperationalEnvironment.ECOMP.equals(requestParameters.getOperationalEnvironmentType())) {
+ throw new ValidationException("operationalEnvironmentType in requestParameters", true);
+ }
+
+ 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", true);
+ }
+
+ if(!empty(relatedInstance.getInstanceName()) && !relatedInstance.getInstanceName().matches(Constants.VALID_INSTANCE_NAME_FORMAT)) {
+ throw new ValidationException ("instanceName format", true);
+ }
+
+ if (empty (relatedInstance.getInstanceId ())) {
+ throw new ValidationException ("instanceId in relatedInstance", true);
+ }
+
+ if (!UUIDChecker.isValidUUID (relatedInstance.getInstanceId ())) {
+ throw new ValidationException ("instanceId format in relatedInstance", true);
+ }
+ }
+ } else {
+ throw new ValidationException ("relatedInstanceList", true);
+ }
+ }
+ }
+
+ private void requestParamsValidation(Action action, RequestParameters requestParameters) throws ValidationException {
+
+ if(requestParameters != null) {
+ if(!Action.deactivate.equals(action) && requestParameters.getOperationalEnvironmentType() == null) {
+ throw new ValidationException ("OperationalEnvironmentType", true);
+ }
+
+ if (Action.create.equals(action) && empty(requestParameters.getTenantContext())) {
+ throw new ValidationException ("Tenant Context", true);
+ }
+ if (!Action.deactivate.equals(action) && empty(requestParameters.getWorkloadContext())) {
+ throw new ValidationException ("Workload Context", true);
+ }
+
+ Manifest manifest = requestParameters.getManifest();
+
+ if(Action.activate.equals(action)) {
+ if(manifest == null) {
+ throw new ValidationException ("Manifest on Activate", true);
+ } else {
+ List<ServiceModelList> serviceModelList = manifest.getServiceModelList();
+
+ if(serviceModelList.isEmpty()) {
+ throw new ValidationException (" empty ServiceModelList", true);
+ }
+
+ for(ServiceModelList list : serviceModelList) {
+ if(empty(list.getServiceModelVersionId())) {
+ throw new ValidationException ("ServiceModelVersionId", true);
+ }
+
+ if (!UUIDChecker.isValidUUID (list.getServiceModelVersionId())) {
+ throw new ValidationException ("ServiceModelVersionId format", true);
+ }
+
+ if(list.getRecoveryAction() == null) {
+ throw new ValidationException ("RecoveryAction", true);
+ }
+ }
+ }
+ }
+ } else if(!Action.deactivate.equals(action)) {
+ throw new ValidationException("request Parameters", true);
+ }
+ }
+
+ private void requestInfoValidation(Action action, RequestInfo requestInfo) throws ValidationException {
+
+ if(Action.create.equals(action) && empty(requestInfo.getInstanceName())) {
+ throw new ValidationException ("instanceName", true);
+ }
+
+ if(!empty(requestInfo.getInstanceName()) && !requestInfo.getInstanceName().matches(Constants.VALID_INSTANCE_NAME_FORMAT)) {
+ throw new ValidationException ("instanceName format", true);
+ }
+
+ if (empty(requestInfo.getSource())) {
+ throw new ValidationException ("source", true);
+ }
+
+ if(empty(requestInfo.getRequestorId())) {
+ throw new ValidationException ("requestorId", true);
+ }
+
+ ResourceType resourceType = requestInfo.getResourceType();
+ if(resourceType == null) {
+ throw new ValidationException ("resourceType", true);
+ }
+
+ this.requestScope = resourceType.name();
+ }
+
+ void parseOrchestration (CloudOrchestrationRequest cor) throws ValidationException {
+
+ this.cor = cor;
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ requestJSON = mapper.writeValueAsString(cor.getRequestDetails());
+
+ } catch(JsonProcessingException e){
+ throw new ValidationException ("Parse CloudOrchestrationRequest to JSON string", e);
+ }
+
+ if(cor.getRequestDetails() == null){
+ throw new ValidationException("requestDetails", true);
+ }
+ this.requestInfo = cor.getRequestDetails().getRequestInfo();
+
+ if (this.requestInfo == null) {
+ throw new ValidationException ("requestInfo", true);
+ }
+
+ if (empty (requestInfo.getSource ())) {
+ throw new ValidationException ("source", true);
+ }
+ if (empty (requestInfo.getRequestorId ())) {
+ throw new ValidationException ("requestorId", true);
+ }
+ }
+
+ public void createRequestRecord (Status status, Action action){
+
+ 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) && requestInfo != null) {
+ 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(Long.valueOf(100));
+
+ Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
+ aq.setEndTime (endTimeStamp);
+ } else if(status == Status.IN_PROGRESS) {
+ aq.setProgress(Constants.PROGRESS_REQUEST_IN_PROGRESS);
+ }
+ infraActiveRequestsRepository.save(aq);
+ }
+
+
+ public Map<String, String> getOrchestrationFilters (MultivaluedMap<String, String> queryParams) throws ValidationException {
+ String queryParam = null;
+ Map<String, String> orchestrationFilterParams = new HashMap<>();
+
+ for (Entry<String,List<String>> 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(), true);
+ }
+ }
+
+ 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<String> variables) {
+
+ this.errorCode = messageId;
+
+ this.errorCode = text != null ? text : "";
+ 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){
+ 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() {
+ try {
+ InfraActiveRequests request = new InfraActiveRequests(requestId);
+ request.setRequestStatus(status.toString());
+ request.setStatusMessage(this.errorMessage);
+ request.setProgress(this.progress);
+ request.setResponseBody(this.responseBody);
+ request.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ infraActiveRequestsRepository.save(request);
+ } 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;
+ case PENDING:
+ break;
+ case TIMEOUT:
+ break;
+ case UNLOCKED:
+ break;
+ default:
+ break;
+ }
+ }
+
+ public String getOperationalEnvironmentId() {
+ return operationalEnvironmentId;
+ }
+
+ public void setOperationalEnvironmentId(String operationalEnvironmentId) {
+ this.operationalEnvironmentId = operationalEnvironmentId;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
new file mode 100644
index 0000000000..461acab96d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
@@ -0,0 +1,103 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation;
+
+import org.apache.http.HttpStatus;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.tenantisolation.process.ActivateVnfOperationalEnvironment;
+import org.onap.so.apihandlerinfra.tenantisolation.process.ActivateVnfStatusOperationalEnvironment;
+import org.onap.so.apihandlerinfra.tenantisolation.process.CreateEcompOperationalEnvironment;
+import org.onap.so.apihandlerinfra.tenantisolation.process.CreateVnfOperationalEnvironment;
+import org.onap.so.apihandlerinfra.tenantisolation.process.DeactivateVnfOperationalEnvironment;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
+import org.onap.so.db.request.data.repository.OperationalEnvDistributionStatusRepository;
+import org.onap.so.db.request.data.repository.OperationalEnvServiceModelStatusRepository;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.RequestsDBHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+
+@Component
+@Scope("prototype")
+public class TenantIsolationRunnable {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, TenantIsolationRunnable.class);
+
+ @Autowired
+ private RequestsDBHelper requestDb;
+ @Autowired
+ private CreateEcompOperationalEnvironment createEcompOpEnv;
+ @Autowired
+ private CreateVnfOperationalEnvironment createVnfOpEnv;
+ @Autowired
+ private ActivateVnfOperationalEnvironment activateVnfOpEnv;
+ @Autowired
+ private DeactivateVnfOperationalEnvironment deactivateVnfOpEnv;
+ @Autowired
+ private ActivateVnfStatusOperationalEnvironment activateVnfStatusOpEnv;
+ @Autowired
+ private OperationalEnvDistributionStatusRepository distributionStatusRepository;
+ @Autowired
+ private OperationalEnvServiceModelStatusRepository modelStatusRepository;
+
+ @Async
+ public void run(Action action, String operationalEnvType, CloudOrchestrationRequest cor, String requestId) throws ApiException {
+ msoLogger.debug ("Starting threadExecution in TenantIsolationRunnable for Action " + action.name() + " and OperationalEnvType: " + operationalEnvType);
+ try {
+
+ if(Action.create.equals(action)) {
+ if(OperationalEnvironment.ECOMP.name().equalsIgnoreCase(operationalEnvType)) {
+ createEcompOpEnv.execute(requestId, cor);
+ } else if(OperationalEnvironment.VNF.name().equalsIgnoreCase(operationalEnvType)) {
+ createVnfOpEnv.execute(requestId, cor);
+ } else {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ValidateException validateException = new ValidateException.Builder("Invalid OperationalEnvironment Type specified for Create Action",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+ } else if(Action.activate.equals(action)) {
+ activateVnfOpEnv.execute(requestId, cor, distributionStatusRepository, modelStatusRepository);
+ } else if(Action.deactivate.equals(action)) {
+ deactivateVnfOpEnv.execute(requestId, cor);
+ } else if(Action.distributionStatus.equals(action)) {
+ activateVnfStatusOpEnv.execute(requestId, cor, distributionStatusRepository, modelStatusRepository);
+ } else {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ValidateException validateException = new ValidateException.Builder("Invalid Action specified: " + action,
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+ }catch(ApiException e) {
+ requestDb.updateInfraFailureCompletion(e.getMessage(), requestId, cor.getOperationalEnvironmentId());
+ throw e;
+ }
+ }
+}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java
new file mode 100644
index 0000000000..44198d727d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java
@@ -0,0 +1,162 @@
+/*-
+ * ============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.onap.so.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;
+
+ 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) {
+ 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/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java
new file mode 100644
index 0000000000..f718431534
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java
@@ -0,0 +1,81 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation.dmaap;
+
+import java.io.IOException;
+
+import javax.inject.Provider;
+
+import org.apache.http.HttpStatus;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class DmaapOperationalEnvClient {
+
+ @Autowired
+ private Provider<OperationalEnvironmentPublisher> dmaapPublisher;
+
+ protected String buildRequest(String operationalEnvironmentId, String operationalEnvironmentName, String operationalEnvironmentType, String tenantContext, String workloadContext, String action )
+ throws ApiException {
+ final CreateEcompOperationEnvironmentBean operationalEnv = new CreateEcompOperationEnvironmentBean();
+ operationalEnv.withOperationalEnvironmentId(operationalEnvironmentId)
+ .withOperationalEnvironmentName(operationalEnvironmentName)
+ .withOperationalEnvironmentType(operationalEnvironmentType)
+ .withTenantContext(tenantContext)
+ .withWorkloadContext(workloadContext)
+ .withaction(action);
+ try {
+ return this.getJson(operationalEnv);
+ }catch(JsonProcessingException ex){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + ex.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(ex).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+ }
+
+ protected String getJson(CreateEcompOperationEnvironmentBean obj) throws JsonProcessingException {
+
+ final ObjectMapper mapper = new ObjectMapper();
+ return mapper.writeValueAsString(obj);
+
+ }
+
+ public void dmaapPublishOperationalEnvRequest(String operationalEnvironmentId, String operationalEnvironmentName, String operationalEnvironmentType,
+ String tenantContext, String workloadContext, String action ) throws ApiException, IOException, InterruptedException {
+
+ String request = this.buildRequest(operationalEnvironmentId, operationalEnvironmentName, operationalEnvironmentType, tenantContext, workloadContext, action);
+ dmaapPublisher.get().send(request);
+
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java
new file mode 100644
index 0000000000..0e26178e56
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation.dmaap;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.so.apihandlerinfra.SpringContextHelper;
+import org.onap.so.client.dmaap.DmaapProperties;
+import org.springframework.context.ApplicationContext;
+
+public class DmaapPropertiesImpl implements DmaapProperties {
+
+ private final Map<String, String> props = new HashMap<>();
+ private static final String[] propertyNames = {
+ "mso.so.operational-environment.dmaap.username",
+ "mso.so.operational-environment.dmaap.password",
+ "mso.so.operational-environment.publisher.topic",
+ "mso.so.operational-environment.dmaap.host"
+ };
+ public DmaapPropertiesImpl () {
+ ApplicationContext context = SpringContextHelper.getAppContext();
+
+ for (String name : propertyNames) {
+ this.props.put(name, context.getEnvironment().getProperty(name));
+
+ }
+
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+
+ return this.props;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java
new file mode 100644
index 0000000000..52c395e1d1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java
@@ -0,0 +1,61 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation.dmaap;
+
+import java.io.IOException;
+import java.util.Optional;
+
+import org.onap.so.client.dmaap.DmaapPublisher;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+@Component
+@Scope("prototype")
+public class OperationalEnvironmentPublisher extends DmaapPublisher {
+
+
+ public OperationalEnvironmentPublisher() throws IOException {
+ super();
+ }
+
+ @Override
+ public String getUserName() {
+
+ return this.msoProperties.get("mso.so.operational-environment.dmaap.username");
+ }
+
+ @Override
+ public String getPassword() {
+
+ return this.msoProperties.get("mso.so.operational-environment.dmaap.password");
+ }
+
+ @Override
+ public String getTopic() {
+
+ return this.msoProperties.get("mso.so.operational-environment.publisher.topic");
+ }
+
+ @Override
+ public Optional<String> getHost() {
+ return Optional.ofNullable(this.msoProperties.get("mso.so.operational-environment.dmaap.host"));
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java
new file mode 100644
index 0000000000..4f4fa1ae35
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java
@@ -0,0 +1,29 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolation/exceptions/SDCClientCallFailed.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/SDCClientCallFailed.java
new file mode 100644
index 0000000000..9cdef3c9d1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/SDCClientCallFailed.java
@@ -0,0 +1,36 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation.exceptions;
+
+public class SDCClientCallFailed extends Exception {
+
+ private static final long serialVersionUID = 3066575499816576134L;
+
+ public SDCClientCallFailed(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public SDCClientCallFailed(String message) {
+ super(message);
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/TenantIsolationException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/TenantIsolationException.java
new file mode 100644
index 0000000000..af3e7937af
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/TenantIsolationException.java
@@ -0,0 +1,36 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java
new file mode 100644
index 0000000000..6fd33a6afc
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java
@@ -0,0 +1,120 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation.helpers;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Map;
+
+import javax.ws.rs.NotFoundException;
+
+import org.onap.so.apihandlerinfra.tenantisolation.exceptions.AAIClientCallFailed;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.aai.objects.AAIOperationalEnvironment;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class AAIClientHelper {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, AAIClientHelper.class);
+
+ /**
+ * Get managing ECOMP Environment Info from A&AI
+ * @param id = operationalEnvironmentId
+ * @return AAIResultWrapper object
+ */
+ public AAIResultWrapper getAaiOperationalEnvironment(String id){
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, id);
+ uri.depth(Depth.ZERO); //Do not return relationships if any
+ AAIResourcesClient client = this.getClient();
+ return client.get(uri, NotFoundException.class);
+ }
+
+
+ /**
+ * Update managing ECOMP Environment Info from A&AI
+ * @param id = operationalEnvironmentId
+ * @param AAIOperationalEnvironment object
+ */
+ public void updateAaiOperationalEnvironment(String id, AAIOperationalEnvironment aaiRequest){
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, id);
+ AAIResourcesClient client = this.getClient();
+ client.update(uri, aaiRequest);
+
+ }
+
+
+ public void updateAaiOperationalEnvironment(String operationalEnvironmentId, Map<String, String> 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){
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, operationalEnvironment.getOperationalEnvironmentId());
+ AAIResourcesClient client = this.getClient();
+ client.create(uri, operationalEnvironment);
+ }
+
+ /**
+ * Create a relationship between ECOMP managing and VNF Operational Environments
+ * @param managingEcompOperationalEnvironmentId
+ * @param vnfOperationalEnvironmentId
+ * @throws Exception
+ */
+ public void createRelationship(String managingEcompOperationalEnvironmentId, String vnfOperationalEnvironmentId) {
+
+ AAIResourceUri ecompEnvUri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, managingEcompOperationalEnvironmentId);
+ AAIResourceUri vnfEnvUri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, vnfOperationalEnvironmentId);
+ AAIResourcesClient client = this.getClient();
+ client.connect(vnfEnvUri, ecompEnvUri);
+
+ }
+
+ private void logStackTrace(Exception e) {
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ }
+
+ protected AAIResourcesClient getClient() {
+ return new AAIResourcesClient();
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java
new file mode 100644
index 0000000000..23642bdfb4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java
@@ -0,0 +1,42 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation.helpers;
+
+import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.onap.so.client.aai.objects.AAIOperationalEnvironment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIClientObjectBuilder {
+
+ public AAIOperationalEnvironment buildAAIOperationalEnvironment(String status, CloudOrchestrationRequest cloudOrchestrationRequest) {
+ AAIOperationalEnvironment env = new AAIOperationalEnvironment();
+ env.setOperationalEnvironmentId(cloudOrchestrationRequest.getOperationalEnvironmentId());
+ env.setOperationalEnvironmentName(cloudOrchestrationRequest.getRequestDetails().getRequestInfo().getInstanceName());
+ env.setOperationalEnvironmentType(cloudOrchestrationRequest.getRequestDetails().getRequestParameters().getOperationalEnvironmentType().toString());
+ env.setOperationalEnvironmentStatus(status);
+ env.setTenantContext(cloudOrchestrationRequest.getRequestDetails().getRequestParameters().getTenantContext());
+ env.setWorkloadContext(cloudOrchestrationRequest.getRequestDetails().getRequestParameters().getWorkloadContext());
+ return env;
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java
new file mode 100644
index 0000000000..dcd3a42875
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java
@@ -0,0 +1,118 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation.helpers;
+
+import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
+import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ActivateVnfDBHelper {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ActivateVnfDBHelper.class);
+
+ /**
+ * Insert record to OperationalEnvServiceModelStatus table
+ * @param requestId - String
+ * @param operationalEnvironmentId - String
+ * @param serviceModelVersionId - String
+ * @param status - String
+ * @param recoveryAction - String
+ * @param retryCount - int
+ * @param workloadContext - String
+ * @return serviceModelStatus - OperationalEnvServiceModelStatus object
+ */
+ public OperationalEnvServiceModelStatus insertRecordToOperationalEnvServiceModelStatus( String requestId,
+ String operationalEnvironmentId,
+ String serviceModelVersionId,
+ String status,
+ String recoveryAction,
+ int retryCount,
+ String workloadContext) {
+ OperationalEnvServiceModelStatus serviceModelStatus = new OperationalEnvServiceModelStatus();
+ serviceModelStatus.setRequestId(requestId);
+ serviceModelStatus.setOperationalEnvId(operationalEnvironmentId);
+ serviceModelStatus.setServiceModelVersionId(serviceModelVersionId);
+ serviceModelStatus.setServiceModelVersionDistrStatus(status);
+ serviceModelStatus.setRecoveryAction(recoveryAction);
+ serviceModelStatus.setRetryCount(new Integer(retryCount));
+ serviceModelStatus.setWorkloadContext(workloadContext);
+ return serviceModelStatus;
+ }
+
+ /**
+ * Update RetryCount & Status in OperationalEnvServiceModelStatus table
+ * @param serviceModelStatusResponse - OperationalEnvServiceModelStatus object
+ * @param status - String
+ * @param retryCount - int
+ * @return serviceModelStatusResponse - OperationalEnvServiceModelStatus object
+ */
+ public OperationalEnvServiceModelStatus updateRetryCountAndStatusInOperationalEnvServiceModelStatus(OperationalEnvServiceModelStatus serviceModelStatusResponse,
+ String status,
+ int retryCount) {
+ serviceModelStatusResponse.setServiceModelVersionDistrStatus(status);
+ serviceModelStatusResponse.setRetryCount(new Integer(retryCount));
+ return serviceModelStatusResponse;
+ }
+
+ /**
+ * Insert record to OperationalEnvDistributionStatus table
+ * @param distributionId - String
+ * @param operationalEnvironmentId - String
+ * @param serviceModelVersionId - String
+ * @param requestId - String
+ * @param status - String
+ * @param distributionIdErrorReason - String
+ * @return distStatus - OperationalEnvDistributionStatus object
+ */
+ public OperationalEnvDistributionStatus insertRecordToOperationalEnvDistributionStatus( String distributionId,
+ String operationalEnvironmentId,
+ String serviceModelVersionId,
+ String requestId,
+ String status,
+ String distributionIdErrorReason) {
+ OperationalEnvDistributionStatus distStatus = new OperationalEnvDistributionStatus();
+ distStatus.setDistributionId(distributionId);
+ distStatus.setOperationalEnvId(operationalEnvironmentId);
+ distStatus.setServiceModelVersionId(serviceModelVersionId);
+ distStatus.setRequestId(requestId);
+ distStatus.setDistributionIdStatus(status);
+ distStatus.setDistributionIdErrorReason(distributionIdErrorReason);
+ return distStatus;
+ }
+
+ /**
+ * Update Status in OperationalEnvDistributionStatus table
+ * @param distributionStatusResponse - OperationalEnvDistributionStatus object
+ * @param status - String
+ * @param distributionIdErrorReason - String
+ * @return distributionStatusResponse - OperationalEnvDistributionStatus object
+ */
+ public OperationalEnvDistributionStatus updateStatusInOperationalEnvDistributionStatus(OperationalEnvDistributionStatus distributionStatusResponse,
+ String status,
+ String distributionIdErrorReason) {
+ distributionStatusResponse.setDistributionIdStatus(status);
+ distributionStatusResponse.setDistributionIdErrorReason(distributionIdErrorReason);
+ return distributionStatusResponse;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
new file mode 100644
index 0000000000..804eb696cb
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
@@ -0,0 +1,236 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation.helpers;
+
+import java.util.UUID;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+
+import org.apache.http.HttpStatus;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.rest.APIResponse;
+import org.onap.so.rest.RESTClient;
+import org.onap.so.rest.RESTConfig;
+import org.onap.so.rest.RESTException;
+import org.onap.so.utils.CryptoUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SDCClientHelper {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, SDCClientHelper.class);
+ private static final String SDC_CONTENT_TYPE = "application/json";
+ private static final String SDC_ACCEPT_TYPE = "application/json";
+ private static String PARTIAL_SDC_URI = "/sdc/v1/catalog/services/";
+
+ private static String MESSAGE_UNDEFINED_ERROR = "Undefined Error Message!";
+ private static String MESSAGE_UNEXPECTED_FORMAT = "Unexpected response format from SDC.";
+
+ @Value("${mso.sdc.endpoint}")
+ private String sdcEndpoint;
+ @Value("${mso.sdc.activate.userid}")
+ private String sdcActivateUserId;
+ @Value("${mso.sdc.activate.instanceid}")
+ private String sdcActivateInstanceId;
+ @Value("${mso.sdc.client.auth}")
+ private String sdcClientAuth;
+ @Value("${mso.msoKey}")
+ private String msoKey;
+
+ /**
+ * Send POST request to SDC for operational activation
+ * @param serviceModelVersionI - String
+ * @param operationalEnvironmentId - String
+ * @param workloadContext - String
+ * @return sdcResponseJsonObj - JSONObject object
+ * @throws JSONException
+ */
+ public JSONObject postActivateOperationalEnvironment(String serviceModelVersionId, String operationalEnvironmentId, String workloadContext) throws ApiException {
+ JSONObject sdcResponseJsonObj = new JSONObject();
+
+ try {
+ String url = this.buildUriBuilder(serviceModelVersionId, operationalEnvironmentId);
+ String jsonPayload = this.buildJsonWorkloadContext(workloadContext);
+ String basicAuthCred = getBasicAuth();
+
+ if ( basicAuthCred == null || "".equals(basicAuthCred) ) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ValidateException validateException = new ValidateException.Builder(" SDC credentials 'mso.sdc.client.auth' not setup in properties file!",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+
+ RESTConfig config = new RESTConfig(url);
+ RESTClient client = setRestClient(config);
+ client.addAuthorizationHeader(basicAuthCred);
+
+ APIResponse apiResponse = setHttpPostResponse(client, jsonPayload);
+ int statusCode = apiResponse.getStatusCode();
+
+ String responseData = apiResponse.getResponseBodyAsString();
+ sdcResponseJsonObj = enhanceJsonResponse(new JSONObject(responseData), statusCode);
+
+ } catch (Exception ex) {
+ msoLogger.debug("calling SDC Exception message: " + ex.getMessage());
+ String errorMessage = " Encountered Error while calling SDC POST Activate. " + ex.getMessage();
+ msoLogger.debug(errorMessage);
+ sdcResponseJsonObj.put("statusCode", String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
+ sdcResponseJsonObj.put("messageId", "");
+ sdcResponseJsonObj.put("message", errorMessage);
+
+ }
+ return sdcResponseJsonObj;
+ }
+
+ /**
+ * set RESTClient
+ * @param config - RESTConfig object
+ * @return client - RestClient object
+ */
+ public RESTClient setRestClient(RESTConfig config) throws Exception {
+ RESTClient client = new RESTClient(config).addHeader("X-ECOMP-InstanceID", sdcActivateInstanceId)
+ .addHeader("X-ECOMP-RequestID", UUID.randomUUID().toString())
+ .addHeader("Content-Type", SDCClientHelper.SDC_CONTENT_TYPE)
+ .addHeader("Accept", SDCClientHelper.SDC_ACCEPT_TYPE)
+ .addHeader("USER_ID", sdcActivateUserId);
+ return client;
+ }
+
+ /**
+ * set HttpPostResponse
+ * @param config - RESTConfig object
+ * @param jsonPayload - String
+ * @return client - RestClient object
+ */
+ public APIResponse setHttpPostResponse(RESTClient client, String jsonPayload) throws ApiException {
+ try {
+ return client.httpPost(jsonPayload);
+ }catch(RESTException ex){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ValidateException validateException = new ValidateException.Builder("Bad request could not post payload",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+ }
+
+ /**
+ * enhance Response
+ * @param sdcResponseJsonObj - JSONObject object
+ * @param statusCode - int
+ * @return enhancedAsdcResponseJsonObj - JSONObject object
+ */
+ public JSONObject enhanceJsonResponse(JSONObject sdcResponseJsonObj, int statusCode) throws JSONException {
+
+ JSONObject enhancedAsdcResponseJsonObj = new JSONObject();
+
+ String message = "";
+ String messageId = "";
+
+ if (statusCode == Response.Status.ACCEPTED.getStatusCode()) { // Accepted
+ enhancedAsdcResponseJsonObj.put("distributionId", sdcResponseJsonObj.get("distributionId"));
+ enhancedAsdcResponseJsonObj.put("statusCode", Integer.toString(statusCode));
+ enhancedAsdcResponseJsonObj.put("messageId", "");
+ enhancedAsdcResponseJsonObj.put("message", "Success");
+
+ } else { // error
+ if (sdcResponseJsonObj.has("requestError") ) {
+ JSONObject requestErrorObj = sdcResponseJsonObj.getJSONObject("requestError");
+ if (sdcResponseJsonObj.getJSONObject("requestError").has("serviceException") ) {
+ message = requestErrorObj.getJSONObject("serviceException").getString("text");
+ messageId = requestErrorObj.getJSONObject("serviceException").getString("messageId");
+ }
+ if (sdcResponseJsonObj.getJSONObject("requestError").has("policyException") ) {
+ message = requestErrorObj.getJSONObject("policyException").getString("text");
+ messageId = requestErrorObj.getJSONObject("policyException").getString("messageId");
+ }
+ enhancedAsdcResponseJsonObj.put("statusCode", Integer.toString(statusCode));
+ enhancedAsdcResponseJsonObj.put("messageId", messageId);
+ enhancedAsdcResponseJsonObj.put("message", message);
+
+ } else {
+ // unexpected format
+ enhancedAsdcResponseJsonObj.put("statusCode", String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
+ enhancedAsdcResponseJsonObj.put("messageId", MESSAGE_UNDEFINED_ERROR);
+ enhancedAsdcResponseJsonObj.put("message", MESSAGE_UNEXPECTED_FORMAT);
+ }
+ }
+ return enhancedAsdcResponseJsonObj;
+
+ }
+
+ /**
+ * Build Uri
+ * @param serviceModelVersionId - String
+ * @param operationalEnvironmentId - String
+ * @return uriBuilder - String
+ */
+ public String buildUriBuilder(String serviceModelVersionId, String operationalEnvironmentId) {
+ String path = serviceModelVersionId + "/distribution/" + operationalEnvironmentId +"/activate";
+ UriBuilder uriBuilder = UriBuilder.fromPath(sdcEndpoint + SDCClientHelper.PARTIAL_SDC_URI)
+ .path(path);
+ return uriBuilder.build().toString();
+ }
+
+ /**
+ * Build JSON context
+ * @param workloadContext - String
+ * @return String json
+ * @throws JSONException
+ */
+ public String buildJsonWorkloadContext(String workloadContext) throws JSONException {
+ return new JSONObject().put("workloadContext", workloadContext).toString();
+
+ }
+
+ /**
+ * decrypt value
+ * @param toDecrypt - String
+ * @param msokey - String
+ * @return result - String
+ */
+ public synchronized String decrypt(String toDecrypt, String msokey){
+ String result = null;
+ try {
+ result = CryptoUtils.decrypt(toDecrypt, msokey);
+
+ }
+ catch (Exception e) {
+ msoLogger.debug("Failed to decrypt credentials: " + toDecrypt, e);
+ }
+ return result;
+ }
+
+ private String getBasicAuth() {
+ return decrypt(sdcClientAuth, msoKey);
+ }
+}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
new file mode 100644
index 0000000000..903639c8f5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
@@ -0,0 +1,183 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation.process;
+
+import java.util.List;
+import java.util.Optional;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.http.HttpStatus;
+import org.json.JSONObject;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
+import org.onap.so.apihandlerinfra.tenantisolation.helpers.ActivateVnfDBHelper;
+import org.onap.so.apihandlerinfra.tenantisolation.helpers.SDCClientHelper;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.ServiceModelList;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.objects.AAIOperationalEnvironment;
+import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
+import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
+import org.onap.so.db.request.data.repository.OperationalEnvDistributionStatusRepository;
+import org.onap.so.db.request.data.repository.OperationalEnvServiceModelStatusRepository;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.RequestsDBHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class ActivateVnfOperationalEnvironment {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ActivateVnfOperationalEnvironment.class);
+ private static final int DEFAULT_ACTIVATE_RETRY_COUNT = 3;
+ private static final String DISTRIBUTION_STATUS_SENT = "SENT";
+
+ @Autowired
+ private ActivateVnfDBHelper dbHelper;
+ @Autowired
+ private AAIClientHelper aaiHelper;
+ @Autowired
+ private RequestsDBHelper requestDb;
+ @Autowired
+ private SDCClientHelper sdcClientHelper;
+
+ @Value("${mso.tenant.isolation.retry.count}")
+ private String sdcRetryCount;
+
+ /**
+ * The Point-Of-Entry from APIH with VID request to send activate request
+ * @param requestId - String
+ * @param request - CloudOrchestrationRequest object
+ * @param distributionStatusRepository - OperationalEnvDistributionStatusRepository object
+ * @param modelStatusRepository - OperationalEnvServiceModelStatusRepository object
+ * @return void - nothing
+ */
+ public void execute(String requestId, CloudOrchestrationRequest request, OperationalEnvDistributionStatusRepository distributionStatusRepository,
+ OperationalEnvServiceModelStatusRepository modelStatusRepository) throws ApiException{
+ String operationalEnvironmentId = request.getOperationalEnvironmentId();
+
+ String vidWorkloadContext = request.getRequestDetails().getRequestParameters().getWorkloadContext();
+ List<ServiceModelList> serviceModelVersionIdList = request.getRequestDetails().getRequestParameters().getManifest().getServiceModelList();
+
+
+ AAIOperationalEnvironment operationalEnv = getAAIOperationalEnvironment(operationalEnvironmentId);
+ String workloadContext = operationalEnv.getWorkloadContext();
+ msoLogger.debug(" aai workloadContext: " + workloadContext);
+ if (!vidWorkloadContext.equals(workloadContext)) {
+
+
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ throw new ValidateException.Builder(" The vid workloadContext did not match from aai record. " + " vid workloadContext:" + vidWorkloadContext + " aai workloadContext:" + workloadContext,
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+ }
+
+ processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext, distributionStatusRepository, modelStatusRepository);
+
+ }
+
+
+ /**
+ * The Method to send the Activation Requests to SDC
+ * @param requestId - String
+ * @param operationalEnvironmentId - String
+ * @param serviceModelVersionIdList - List<ServiceModelList> list
+ * @param workloadContext - String
+ * @param distributionStatusRepository - OperationalEnvDistributionStatusRepository object
+ * @param modelStatusRepository - OperationalEnvServiceModelStatusRepository object
+ * @return jsonResponse - JSONObject object
+ */
+ public void processActivateSDCRequest(String requestId, String operationalEnvironmentId, List<ServiceModelList> serviceModelVersionIdList,
+ String workloadContext, OperationalEnvDistributionStatusRepository distributionStatusRepository,
+ OperationalEnvServiceModelStatusRepository modelStatusRepository) throws ApiException {
+
+ JSONObject jsonResponse = null;
+ int retryCount = 0;
+ try {
+ retryCount = Integer.parseInt(sdcRetryCount);
+ } catch (NumberFormatException e) {
+ retryCount = DEFAULT_ACTIVATE_RETRY_COUNT;
+ }
+
+ // loop through the serviceModelVersionId, and send request SDC
+ for(ServiceModelList serviceModelList : serviceModelVersionIdList){
+ String serviceModelVersionId = serviceModelList.getServiceModelVersionId();
+ String recoveryAction = serviceModelList.getRecoveryAction().toString().toUpperCase();
+
+ // should insert 1 row
+ OperationalEnvServiceModelStatus serviceModelStatus =
+ dbHelper.insertRecordToOperationalEnvServiceModelStatus(requestId,
+ operationalEnvironmentId,
+ serviceModelVersionId,
+ DISTRIBUTION_STATUS_SENT,
+ recoveryAction,
+ retryCount,
+ workloadContext);
+ modelStatusRepository.save(serviceModelStatus);
+
+ String distributionId = "";
+
+ jsonResponse = sdcClientHelper.postActivateOperationalEnvironment(serviceModelVersionId, operationalEnvironmentId, workloadContext);
+
+ String statusCode = jsonResponse.get("statusCode").toString();
+ if (statusCode.equals(String.valueOf(Response.Status.ACCEPTED.getStatusCode()))) {
+ distributionId = jsonResponse.get("distributionId").toString();
+ // should insert 1 row
+ OperationalEnvDistributionStatus distStatus =
+ dbHelper.insertRecordToOperationalEnvDistributionStatus(distributionId,
+ operationalEnvironmentId,
+ serviceModelVersionId,
+ requestId,
+ DISTRIBUTION_STATUS_SENT,
+ "");
+ distributionStatusRepository.save(distStatus);
+
+ } else {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ String dbErrorMessage = " Failure calling SDC: statusCode: " + statusCode +
+ "; messageId: " + jsonResponse.get("messageId") +
+ "; message: " + jsonResponse.get("message");
+
+ requestDb.updateInfraFailureCompletion(dbErrorMessage, requestId, operationalEnvironmentId);
+ throw new ValidateException.Builder(dbErrorMessage,
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+ }
+ }
+
+ }
+
+ /**
+ * Get AAIOperationalEnvironment object
+ * @param operationalEnvironmentId - String
+ * @return operationalEnv - AAIOperationalEnvironment object
+ */
+ public AAIOperationalEnvironment getAAIOperationalEnvironment(String operationalEnvironmentId) {
+ AAIResultWrapper aaiResult = aaiHelper.getAaiOperationalEnvironment(operationalEnvironmentId);
+ return aaiResult.asBean(AAIOperationalEnvironment.class).orElse(new AAIOperationalEnvironment());
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
new file mode 100644
index 0000000000..6a9bec5abb
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
@@ -0,0 +1,300 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation.process;
+
+
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.http.HttpStatus;
+import org.json.JSONObject;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.onap.so.apihandlerinfra.tenantisolation.helpers.ActivateVnfDBHelper;
+import org.onap.so.apihandlerinfra.tenantisolation.helpers.SDCClientHelper;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus;
+import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
+import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
+import org.onap.so.db.request.data.repository.OperationalEnvDistributionStatusRepository;
+import org.onap.so.db.request.data.repository.OperationalEnvServiceModelStatusRepository;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.RequestsDBHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ActivateVnfStatusOperationalEnvironment {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ActivateVnfStatusOperationalEnvironment.class);
+ private String origRequestId = "";
+ private String errorMessage = "";
+ private OperationalEnvDistributionStatus queryDistributionDbResponse = null;
+ private OperationalEnvServiceModelStatus queryServiceModelResponse = null;
+
+ private final int RETRY_COUNT_ZERO = 0;
+ private final String ERROR_REASON_ABORTED = "ABORTED";
+ private final String RECOVERY_ACTION_RETRY = "RETRY";
+ private final String RECOVERY_ACTION_ABORT = "ABORT";
+ private final String RECOVERY_ACTION_SKIP = "SKIP";
+ private final String DISTRIBUTION_STATUS_OK = DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString();
+ private final String DISTRIBUTION_STATUS_ERROR = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString();
+ private final String DISTRIBUTION_STATUS_SENT = "SENT";
+
+ private final String MESSAGE_UNDEFINED_ID = "Undefined Error Message!";
+
+ @Autowired
+ private ActivateVnfDBHelper dbHelper;
+ @Autowired
+ private RequestsDBHelper requestDb;
+ @Autowired
+ private SDCClientHelper sdcClientHelper;
+
+ /**
+ * The Point-Of-Entry from APIH with activate status from SDC
+ * @param requestId - String
+ * @param request - CloudOrchestrationRequest - object
+ * @param distributionStatusRepository - OperationalEnvDistributionStatusRepository - object
+ * @param modelStatusRepository - OperationalEnvServiceModelStatusRepository - object
+ * @return void - nothing
+ */
+ public void execute(String requestId, CloudOrchestrationRequest request, OperationalEnvDistributionStatusRepository distributionStatusRepository,
+ OperationalEnvServiceModelStatusRepository modelStatusRepository) throws ApiException {
+
+
+ String operationalEnvironmentId = "";
+
+ String sdcDistributionId = request.getDistributionId();
+ Distribution sdcStatus = request.getDistribution();
+
+ // Distribution, Query for operationalEnvironmentId, serviceModelVersionId
+ this.queryDistributionDbResponse = distributionStatusRepository.findOne(sdcDistributionId);
+ operationalEnvironmentId = this.queryDistributionDbResponse.getOperationalEnvId();
+
+ // ServiceModel, Query for dbRequestId, recoveryAction, retryCountString
+ this.queryServiceModelResponse = modelStatusRepository.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, queryDistributionDbResponse.getServiceModelVersionId());
+ this.origRequestId = this.queryServiceModelResponse.getRequestId();
+
+ processActivateSDCStatus(sdcDistributionId, sdcStatus, this.queryDistributionDbResponse, this.queryServiceModelResponse, distributionStatusRepository, modelStatusRepository);
+
+ // After EVERY status processed, need to query the status of all service modelId
+ // to determine the OVERALL status if "COMPLETE" or "FAILURE":
+ checkOrUpdateOverallStatus(operationalEnvironmentId, this.origRequestId, modelStatusRepository);
+
+ }
+
+ /**
+ * The Method to process the Activation Status from SDC
+ * @param sdcDistributionId - string
+ * @param sdcStatus - Distribution object
+ * @param queryDistributionDbResponse - OperationalEnvDistributionStatus object
+ * @param queryServiceModelResponse - OperationalEnvServiceModelStatus object
+ * @param distributionStatusRepository - OperationalEnvDistributionStatusRepository object
+ * @param modelStatusRepository - OperationalEnvServiceModelStatusRepository object
+ * @return void - nothing
+ */
+ public void processActivateSDCStatus(String sdcDistributionId, Distribution sdcStatus, OperationalEnvDistributionStatus queryDistributionDbResponse,
+ OperationalEnvServiceModelStatus queryServiceModelResponse, OperationalEnvDistributionStatusRepository distributionStatusRepository,
+ OperationalEnvServiceModelStatusRepository modelStatusRepository) throws ApiException {
+
+ String sdcStatusValue = sdcStatus.getStatus().toString();
+ String recoveryAction = queryServiceModelResponse.getRecoveryAction();
+ int retryCount = queryServiceModelResponse.getRetryCount();
+
+ // Validate/process status
+ if (sdcStatus.getStatus().toString().equals(DISTRIBUTION_STATUS_OK)) {
+ // should update 1 row, update status to "DISTRIBUTION_COMPLETE_OK"
+ OperationalEnvDistributionStatus updateDistStatusOk =
+ dbHelper.updateStatusInOperationalEnvDistributionStatus(queryDistributionDbResponse,
+ sdcStatusValue,
+ "");
+ distributionStatusRepository.save(updateDistStatusOk);
+ // should update 1 row, update status and retryCount = 0 (ie, serviceModelVersionId is DONE!)
+ OperationalEnvServiceModelStatus updateRetryCountZeroAndStatusOk =
+ dbHelper.updateRetryCountAndStatusInOperationalEnvServiceModelStatus(queryServiceModelResponse,
+ sdcStatusValue,
+ RETRY_COUNT_ZERO);
+ modelStatusRepository.save(updateRetryCountZeroAndStatusOk);
+ } else {
+
+ // "DISTRIBUTION_COMPLETE_ERROR", Check if recoveryAction is "RETRY"
+ if (recoveryAction.equals(RECOVERY_ACTION_RETRY) && retryCount > RETRY_COUNT_ZERO) {
+
+ // RESEND / RETRY serviceModelVersionId to SDC
+
+ JSONObject jsonResponse = callSDClientForRetry(queryDistributionDbResponse, queryServiceModelResponse, sdcStatus,
+ distributionStatusRepository, modelStatusRepository);
+
+ } else { // either RETRY & Count = 0, or 'ABORT', or 'SKIP'
+
+ if (recoveryAction.equals(RECOVERY_ACTION_SKIP) || recoveryAction.equals(RECOVERY_ACTION_ABORT)) {
+ String modifiedStatus = "";
+ String errorReason = "";
+ if (recoveryAction.equals(RECOVERY_ACTION_SKIP)) { // considered SUCCESS
+ modifiedStatus = DISTRIBUTION_STATUS_OK;
+ } else {
+ if (recoveryAction.equals(RECOVERY_ACTION_ABORT)) {
+ modifiedStatus = DISTRIBUTION_STATUS_ERROR; // ABORT, error
+ errorReason = ERROR_REASON_ABORTED;
+ }
+ }
+
+ sdcStatusValue = modifiedStatus;
+ // should update 1 row, modified status & retryCount set 0
+ OperationalEnvServiceModelStatus updateRetryCountZeroAndStatus =
+ dbHelper.updateRetryCountAndStatusInOperationalEnvServiceModelStatus(queryServiceModelResponse,
+ modifiedStatus,
+ RETRY_COUNT_ZERO);
+ modelStatusRepository.save(updateRetryCountZeroAndStatus);
+ // should update 1 row, modified status
+ OperationalEnvDistributionStatus updateDistStatus =
+ dbHelper.updateStatusInOperationalEnvDistributionStatus(queryDistributionDbResponse,
+ modifiedStatus,
+ errorReason);
+ distributionStatusRepository.save(updateDistStatus);
+ } else {
+ // RETRY & Count = 0 (do nothing!)
+ }
+ }
+ }
+ }
+
+ /**
+ * The Method to call SDC for recoveryActioin RETRY
+ * @param queryDistributionDbResponse - OperationalEnvDistributionStatus object
+ * @param queryServiceModelResponse - OperationalEnvServiceModelStatus object
+ * @param sdcStatus - Distribution object
+ * @param distributionStatusRepository - OperationalEnvDistributionStatusRepository object
+ * @param modelStatusRepository - OperationalEnvServiceModelStatusRepository object
+ * @return JSONObject object
+ */
+ public JSONObject callSDClientForRetry(OperationalEnvDistributionStatus queryDistributionDbResponse,
+ OperationalEnvServiceModelStatus queryServiceModelResponse,
+ Distribution sdcStatus,
+ OperationalEnvDistributionStatusRepository distributionStatusRepository,
+ OperationalEnvServiceModelStatusRepository modelStatusRepository) throws ApiException {
+
+ JSONObject jsonResponse = null;
+
+ String operEnvironmentId = queryDistributionDbResponse.getOperationalEnvId();
+ String serviceModelVersionId = queryDistributionDbResponse.getServiceModelVersionId();
+ String originalRequestId = queryServiceModelResponse.getRequestId();
+ int retryCount = queryServiceModelResponse.getRetryCount();
+ String workloadContext = queryServiceModelResponse.getWorkloadContext();
+
+
+ jsonResponse = sdcClientHelper.postActivateOperationalEnvironment(serviceModelVersionId, operEnvironmentId, workloadContext);
+ String statusCode = jsonResponse.get("statusCode").toString();
+ if (statusCode.equals(String.valueOf(Response.Status.ACCEPTED.getStatusCode()))) {
+ String newDistributionId = jsonResponse.get("distributionId").toString();
+ // should insert 1 row, NEW distributionId for replacement of the serviceModelServiceId record
+ OperationalEnvDistributionStatus insertNewDistributionId =
+ dbHelper.insertRecordToOperationalEnvDistributionStatus(newDistributionId,
+ operEnvironmentId,
+ serviceModelVersionId,
+ originalRequestId,
+ DISTRIBUTION_STATUS_SENT,
+ "");
+ distributionStatusRepository.save(insertNewDistributionId);
+
+ // update retryCount (less 1) for the serviceModelServiceId
+ retryCount = retryCount - 1;
+ // should update 1 row, original insert
+ OperationalEnvServiceModelStatus updateRetryCountAndStatus =
+ dbHelper.updateRetryCountAndStatusInOperationalEnvServiceModelStatus(queryServiceModelResponse,
+ DISTRIBUTION_STATUS_SENT,
+ retryCount);
+ modelStatusRepository.save(updateRetryCountAndStatus);
+
+ // should update 1 row, OLD distributionId set to status error (ie, old distributionId is DONE!).
+ OperationalEnvDistributionStatus updateStatus =
+ dbHelper.updateStatusInOperationalEnvDistributionStatus(queryDistributionDbResponse,
+ DISTRIBUTION_STATUS_ERROR,
+ sdcStatus.getErrorReason());
+ distributionStatusRepository.save(updateStatus);
+ } else {
+ String dbErrorMessage = "Failure calling SDC: statusCode: " + statusCode +
+ "; messageId: " + jsonResponse.get("messageId") +
+ "; message: " + jsonResponse.get("message");
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ValidateException validateException = new ValidateException.Builder(dbErrorMessage,
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+ requestDb.updateInfraFailureCompletion(dbErrorMessage, this.origRequestId, operEnvironmentId);
+ throw validateException;
+ }
+
+ return jsonResponse;
+
+ }
+
+
+ /**
+ * The Method to check the overall status of the Activation for an operationalEnvironmentId
+ * @param operationalEnvironmentId - string
+ * @param origRequestId - string
+ * @param modelStatusRepository - OperationalEnvServiceModelStatusRepository object
+ * @return void - nothing
+ */
+ public void checkOrUpdateOverallStatus(String operationalEnvironmentId, String origRequestId, OperationalEnvServiceModelStatusRepository modelStatusRepository) throws ApiException{
+
+ List<OperationalEnvServiceModelStatus> queryServiceModelResponseList = modelStatusRepository.findAllByOperationalEnvIdAndRequestId(operationalEnvironmentId, origRequestId);
+
+ String status = "Waiting";
+ int count = 0;
+ // loop through the statuses of the service model
+ for (OperationalEnvServiceModelStatus querySrvModelResponse : queryServiceModelResponseList) {
+ status = querySrvModelResponse.getServiceModelVersionDistrStatus();
+ // all should be OK to be completed.
+ if ((status.equals(DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString()) &&
+ (querySrvModelResponse.getRetryCount() == 0))) {
+ status = "Completed";
+ count ++;
+ }
+ // one error with zero retry, means all are failures.
+ if ((status.equals(DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString()) &&
+ (querySrvModelResponse.getRetryCount() == 0))) {
+ status = "Failure";
+ count = queryServiceModelResponseList.size();
+ break;
+ }
+ }
+
+ if (status.equals("Completed") && queryServiceModelResponseList.size() == count) {
+ String messageStatus = "Overall Activation process is complete. " + status;
+ requestDb.updateInfraSuccessCompletion(messageStatus, origRequestId, operationalEnvironmentId);
+ } else {
+ if (status.equals("Failure") && queryServiceModelResponseList.size() == count) {
+ this.errorMessage = "Overall Activation process is a Failure. " + status;
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ValidateException validateException = new ValidateException.Builder(this.errorMessage,
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+ requestDb.updateInfraFailureCompletion(this.errorMessage, origRequestId, operationalEnvironmentId);
+ throw validateException;
+ }
+
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
new file mode 100644
index 0000000000..c16f7bb9ef
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
@@ -0,0 +1,83 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation.process;
+
+import org.apache.http.HttpStatus;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.onap.so.apihandlerinfra.tenantisolation.dmaap.DmaapOperationalEnvClient;
+import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
+import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientObjectBuilder;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.RequestsDBHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CreateEcompOperationalEnvironment {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CreateEcompOperationalEnvironment.class);
+
+ @Autowired
+ private AAIClientObjectBuilder aaiClientObjectBuilder;
+ @Autowired
+ private AAIClientHelper aaiHelper;
+ @Autowired
+ private RequestsDBHelper requestDb;
+ @Autowired
+ private DmaapOperationalEnvClient dmaapClient;
+
+ public void execute(String requestId, CloudOrchestrationRequest request) throws ApiException{
+
+ //Create ECOMP Managing Environment object in A&AI
+ aaiHelper.createOperationalEnvironment(aaiClientObjectBuilder.buildAAIOperationalEnvironment("ACTIVE", request));
+
+ // Call client to publish to DMaap
+ try {
+ msoLogger.debug("1" + request.getOperationalEnvironmentId());
+ msoLogger.debug("2" + request.getRequestDetails().getRequestInfo().getInstanceName());
+ msoLogger.debug("3" + request.getRequestDetails().getRequestParameters().getOperationalEnvironmentType().toString());
+ msoLogger.debug("4" + request.getRequestDetails().getRequestParameters().getTenantContext());
+ msoLogger.debug("5" + request.getRequestDetails().getRequestParameters().getWorkloadContext());
+
+
+ dmaapClient.dmaapPublishOperationalEnvRequest(request.getOperationalEnvironmentId(),
+ request.getRequestDetails().getRequestInfo().getInstanceName(),
+ request.getRequestDetails().getRequestParameters().getOperationalEnvironmentType().toString(),
+ request.getRequestDetails().getRequestParameters().getTenantContext(),
+ request.getRequestDetails().getRequestParameters().getWorkloadContext(),
+ "Create");
+ }catch(Exception e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ValidateException validateException = new ValidateException.Builder("Could not publish DMaap", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ requestDb.updateInfraFailureCompletion(e.getMessage(), requestId, request.getOperationalEnvironmentId());
+ throw validateException;
+ }
+ //Update request database
+ requestDb.updateInfraSuccessCompletion("SUCCESSFULLY Created ECOMP OperationalEnvironment.", requestId, request.getOperationalEnvironmentId());
+
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
new file mode 100644
index 0000000000..e95db6b188
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
@@ -0,0 +1,227 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation.process;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.NotFoundException;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpStatus;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.onap.so.apihandlerinfra.tenantisolation.exceptions.TenantIsolationException;
+import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
+import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientObjectBuilder;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.RelatedInstanceList;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.objects.AAIOperationalEnvironment;
+import org.onap.so.client.grm.GRMClient;
+import org.onap.so.client.grm.beans.OperationalInfo;
+import org.onap.so.client.grm.beans.Property;
+import org.onap.so.client.grm.beans.ServiceEndPoint;
+import org.onap.so.client.grm.beans.ServiceEndPointList;
+import org.onap.so.client.grm.beans.ServiceEndPointRequest;
+import org.onap.so.client.grm.beans.Version;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.RequestsDBHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class CreateVnfOperationalEnvironment {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CreateVnfOperationalEnvironment.class);
+ protected CloudOrchestrationRequest request;
+
+ @Autowired
+ private AAIClientObjectBuilder aaiClientObjectBuilder;
+ @Autowired
+ private AAIClientHelper aaiHelper;
+ @Autowired
+ private RequestsDBHelper requestDb;
+ private GRMClient grmClient;
+
+ public void execute(String requestId, CloudOrchestrationRequest request) throws ApiException{
+ try {
+ setRequest(request);
+ ObjectMapper objectMapper = new ObjectMapper();
+ AAIResultWrapper aaiResultWrapper = aaiHelper.getAaiOperationalEnvironment(getEcompManagingEnvironmentId());
+ if (aaiResultWrapper.isEmpty()) {
+ throw new NotFoundException(getEcompManagingEnvironmentId() + " not found in A&AI");
+ }
+ AAIOperationalEnvironment aaiEnv = objectMapper.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 = objectMapper.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<ServiceEndPointRequest> serviceEndpointRequestList = buildEndPointRequestList(sel);
+ int ctr = 0;
+ int total = serviceEndpointRequestList.size();
+ for (ServiceEndPointRequest requestList : serviceEndpointRequestList) {
+ msoLogger.debug("Creating endpoint " + ++ctr + " of " + total + ": " + requestList.getServiceEndPoint().getName());
+ getGrmClient().addServiceEndPoint(requestList);
+ }
+
+ //Create VNF operating in A&AI
+ aaiHelper.createOperationalEnvironment(aaiClientObjectBuilder.buildAAIOperationalEnvironment("INACTIVE", request));
+ aaiHelper.createRelationship(request.getOperationalEnvironmentId(), getEcompManagingEnvironmentId());
+
+ //Update request database
+ requestDb.updateInfraSuccessCompletion("SUCCESSFULLY created VNF operational environment", requestId, request.getOperationalEnvironmentId());
+
+ }catch(Exception e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder(e.getMessage(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+ }
+
+
+ protected String getEcompManagingEnvironmentId() throws TenantIsolationException {
+ RelatedInstanceList[] relatedInstances = request.getRequestDetails().getRelatedInstanceList();
+ if (relatedInstances.length > 0 && relatedInstances[0].getRelatedInstance() != null) {
+ return relatedInstances[0].getRelatedInstance().getInstanceId();
+ } else {
+ return null;
+ }
+ }
+
+
+ protected String getTenantContext() throws TenantIsolationException {
+ if(!StringUtils.isEmpty(request.getRequestDetails().getRequestParameters().getTenantContext())) {
+ return request.getRequestDetails().getRequestParameters().getTenantContext();
+ }
+ else {
+ throw new TenantIsolationException("Tenant Context is missing from request!");
+ }
+ }
+
+
+ private List<ServiceEndPointRequest> buildEndPointRequestList(ServiceEndPointList serviceEndPointList) throws TenantIsolationException {
+ List<ServiceEndPoint> endpointList = serviceEndPointList.getServiceEndPointList();
+ msoLogger.debug("Number of service endpoints from GRM: " + endpointList.size());
+ List<ServiceEndPointRequest> serviceEndPointRequestList = new ArrayList<ServiceEndPointRequest>();
+ 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<Property> 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 = request.getRequestDetails().getRequestParameters().getTenantContext();
+ String workloadContext = request.getRequestDetails().getRequestParameters().getWorkloadContext();
+ return tenantContext + "." + workloadContext + "." + serviceName;
+ }
+
+ protected String getSearchKey(AAIOperationalEnvironment aaiEnv) {
+ return aaiEnv.getTenantContext() + "." + aaiEnv.getWorkloadContext() + ".*";
+ }
+
+ public void setRequest(CloudOrchestrationRequest request) {
+ this.request = request;
+ }
+
+ private GRMClient getGrmClient() {
+ if(grmClient == null) {
+ this.grmClient = new GRMClient();
+ }
+
+ return grmClient;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
new file mode 100644
index 0000000000..2096011caa
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
@@ -0,0 +1,89 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolation.process;
+
+import java.util.Optional;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpStatus;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.objects.AAIOperationalEnvironment;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.RequestsDBHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DeactivateVnfOperationalEnvironment {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, DeactivateVnfOperationalEnvironment.class);
+
+ @Autowired
+ private AAIClientHelper aaiHelper;
+ @Autowired
+ private RequestsDBHelper requestDb;
+
+ public void execute(String requestId, CloudOrchestrationRequest request) throws ApiException {
+ String operationalEnvironmentId = request.getOperationalEnvironmentId();
+
+ AAIOperationalEnvironment aaiOpEnv = getAAIOperationalEnvironment(operationalEnvironmentId);
+ if (aaiOpEnv != null) {
+ String operationalEnvironmentStatus = aaiOpEnv.getOperationalEnvironmentStatus();
+
+ if(StringUtils.isBlank(operationalEnvironmentStatus)) {
+ String error = "OperationalEnvironmentStatus is null on OperationalEnvironmentId: " + operationalEnvironmentId;
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ throw new ValidateException.Builder(error, HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
+ .errorInfo(errorLoggerInfo)
+ .build();
+ }
+
+ if(operationalEnvironmentStatus.equalsIgnoreCase("ACTIVE")) {
+
+ aaiOpEnv.setOperationalEnvironmentStatus("INACTIVE");
+ aaiHelper.updateAaiOperationalEnvironment(operationalEnvironmentId, aaiOpEnv);
+
+ } else if(!operationalEnvironmentStatus.equalsIgnoreCase("INACTIVE")) {
+ String error = "Invalid OperationalEnvironmentStatus on OperationalEnvironmentId: " + operationalEnvironmentId;
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ValidateException validateException = new ValidateException.Builder(error,
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+ requestDb.updateInfraFailureCompletion(error, requestId, operationalEnvironmentId);
+ throw validateException;
+ }
+
+ requestDb.updateInfraSuccessCompletion("SUCCESSFULLY Deactivated OperationalEnvironment", requestId, operationalEnvironmentId);
+ }
+ }
+
+ private AAIOperationalEnvironment getAAIOperationalEnvironment(String operationalEnvironmentId) {
+ AAIResultWrapper aaiResult = aaiHelper.getAaiOperationalEnvironment(operationalEnvironmentId);
+ Optional<AAIOperationalEnvironment> operationalEnvironmentOpt = aaiResult.asBean(AAIOperationalEnvironment.class);
+ return operationalEnvironmentOpt.isPresent() ? operationalEnvironmentOpt.get() : null;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Action.java
new file mode 100644
index 0000000000..3f7a5536f3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Action.java
@@ -0,0 +1,28 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolationbeans;
+
+public enum Action {
+ create,
+ activate,
+ deactivate,
+ distributionStatus
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/CloudOrchestrationRequestList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/CloudOrchestrationRequestList.java
new file mode 100644
index 0000000000..25c8538003
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/CloudOrchestrationRequestList.java
@@ -0,0 +1,37 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolationbeans;
+
+import java.util.List;
+
+public class CloudOrchestrationRequestList {
+
+ private List<CloudOrchestrationResponse> requestList;
+
+ public List<CloudOrchestrationResponse> getRequestList() {
+ return requestList;
+ }
+
+ public void setRequestList(List<CloudOrchestrationResponse> requestList) {
+ this.requestList = requestList;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/CloudOrchestrationResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/CloudOrchestrationResponse.java
new file mode 100644
index 0000000000..bd5167c395
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/CloudOrchestrationResponse.java
@@ -0,0 +1,38 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolationbeans/Distribution.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Distribution.java
new file mode 100644
index 0000000000..b556178427
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Distribution.java
@@ -0,0 +1,50 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolationbeans;
+
+import java.io.Serializable;
+
+public class Distribution implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -529289171571892371L;
+ 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/onap/so/apihandlerinfra/tenantisolationbeans/DistributionStatus.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/DistributionStatus.java
new file mode 100644
index 0000000000..d54c6238ae
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/DistributionStatus.java
@@ -0,0 +1,26 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolationbeans;
+
+public enum DistributionStatus {
+ DISTRIBUTION_COMPLETE_OK,
+ DISTRIBUTION_COMPLETE_ERROR
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/InstanceReferences.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/InstanceReferences.java
new file mode 100644
index 0000000000..097660d9f3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/InstanceReferences.java
@@ -0,0 +1,60 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolationbeans/Manifest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Manifest.java
new file mode 100644
index 0000000000..afb9ebdff3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Manifest.java
@@ -0,0 +1,53 @@
+/*-
+ * ============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.onap.so.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> serviceModelList = new ArrayList<ServiceModelList>();
+
+ public List<ServiceModelList> getServiceModelList() {
+ return serviceModelList;
+ }
+
+ public void setServiceModelList(List<ServiceModelList> 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/onap/so/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java
new file mode 100644
index 0000000000..61acc9f94c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java
@@ -0,0 +1,27 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolationbeans;
+
+public enum OperationalEnvironment {
+
+ ECOMP,
+ VNF
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RecoveryAction.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RecoveryAction.java
new file mode 100644
index 0000000000..f32c11f8a8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RecoveryAction.java
@@ -0,0 +1,28 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolationbeans;
+
+public enum RecoveryAction {
+
+ retry,
+ abort,
+ skip
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RelatedInstance.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RelatedInstance.java
new file mode 100644
index 0000000000..78faea7b8e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RelatedInstance.java
@@ -0,0 +1,68 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolationbeans/RelatedInstanceList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RelatedInstanceList.java
new file mode 100644
index 0000000000..ee54392e9d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RelatedInstanceList.java
@@ -0,0 +1,45 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolationbeans/Request.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Request.java
new file mode 100644
index 0000000000..7d927512e6
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Request.java
@@ -0,0 +1,90 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolationbeans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+
+@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;
+ }
+
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestDetails.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestDetails.java
new file mode 100644
index 0000000000..36e3bf95e7
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestDetails.java
@@ -0,0 +1,104 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolationbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestInfo.java
new file mode 100644
index 0000000000..d57d4bf366
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestInfo.java
@@ -0,0 +1,118 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolationbeans/RequestList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestList.java
new file mode 100644
index 0000000000..170b5e7609
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestList.java
@@ -0,0 +1,93 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolationbeans;
+
+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 + "]";
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestParameters.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestParameters.java
new file mode 100644
index 0000000000..1a12c47d7d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestParameters.java
@@ -0,0 +1,84 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolationbeans/RequestReferences.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestReferences.java
new file mode 100644
index 0000000000..337de3c51d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestReferences.java
@@ -0,0 +1,96 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolationbeans/RequestStatus.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestStatus.java
new file mode 100644
index 0000000000..7ef712e124
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestStatus.java
@@ -0,0 +1,69 @@
+/*-
+ * ============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.onap.so.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 = "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;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/ResourceType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/ResourceType.java
new file mode 100644
index 0000000000..835c2657d1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/ResourceType.java
@@ -0,0 +1,26 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolationbeans;
+
+public enum ResourceType {
+
+ operationalEnvironment
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/ServiceModelList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/ServiceModelList.java
new file mode 100644
index 0000000000..4dea3149ad
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/ServiceModelList.java
@@ -0,0 +1,59 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolationbeans/Status.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Status.java
new file mode 100644
index 0000000000..a7c6c67395
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Status.java
@@ -0,0 +1,26 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java
new file mode 100644
index 0000000000..003cb0815a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java
@@ -0,0 +1,95 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java
new file mode 100644
index 0000000000..15a0ab840c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java
@@ -0,0 +1,115 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/tenantisolationbeans/TenantSyncResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/TenantSyncResponse.java
new file mode 100644
index 0000000000..7281e1c708
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/TenantSyncResponse.java
@@ -0,0 +1,35 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.tenantisolationbeans;
+
+public class TenantSyncResponse {
+
+ private RequestReferences requestReferences;
+
+ public RequestReferences getRequestReferences() {
+ return requestReferences;
+ }
+
+ public void setRequestReferences(RequestReferences requestReferences) {
+ this.requestReferences = requestReferences;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/package-info.java
new file mode 100644
index 0000000000..713a763321
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/package-info.java
@@ -0,0 +1,29 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.apihandlerinfra.tenantisolationbeans;
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ApplyUpdatedConfigValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ApplyUpdatedConfigValidation.java
new file mode 100644
index 0000000000..243bbf1474
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ApplyUpdatedConfigValidation.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+import org.onap.so.serviceinstancebeans.RequestParameters;
+
+public class ApplyUpdatedConfigValidation implements ValidationRule{
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+ @Override
+ public ValidationInformation validate(ValidationInformation info) throws ValidationException{
+ RequestParameters requestParameters = info.getSir().getRequestDetails().getRequestParameters();
+ RequestInfo requestInfo = info.getSir().getRequestDetails().getRequestInfo();
+
+ 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");
+ }
+ return info;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java
new file mode 100644
index 0000000000..4c7365b187
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java
@@ -0,0 +1,75 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
+import org.onap.so.serviceinstancebeans.ModelType;
+
+public class CloudConfigurationValidation implements ValidationRule{
+ public boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+ @Override
+ public ValidationInformation validate(ValidationInformation info) throws ValidationException{
+ CloudConfiguration cloudConfiguration = info.getSir().getRequestDetails().getCloudConfiguration();
+ String requestScope = info.getRequestScope();
+ int reqVersion = info.getReqVersion();
+ Actions action = info.getAction();
+ Boolean aLaCarteFlag = info.getALaCarteFlag();
+
+
+ if(cloudConfiguration == null && reqVersion >= 5 && (aLaCarteFlag != null && aLaCarteFlag)){
+ if((!requestScope.equalsIgnoreCase(ModelType.service.name()) && !requestScope.equalsIgnoreCase(ModelType.configuration.name())) &&
+ (action == Action.createInstance || action == Action.deleteInstance || action == Action.updateInstance)){
+ throw new ValidationException ("cloudConfiguration");
+ }
+ if((requestScope.equalsIgnoreCase(ModelType.vnf.name()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name())) &&
+ action == Action.replaceInstance){
+ throw new ValidationException ("cloudConfiguration");
+ }
+ if(requestScope.equalsIgnoreCase(ModelType.configuration.name()) &&
+ (action == Action.enablePort || action == Action.disablePort || action == Action.activateInstance || action == Action.deactivateInstance)){
+ throw new ValidationException ("cloudConfiguration");
+ }
+ if(requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.deactivateAndCloudDelete){
+ throw new ValidationException("cloudConfiguration");
+ }
+ }
+
+ if (cloudConfiguration == null && ((aLaCarteFlag != null && !aLaCarteFlag) && requestScope.equalsIgnoreCase (ModelType.service.name ()) && reqVersion < 5)) {
+ 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");
+ }
+ }
+ return info;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InPlaceSoftwareUpdateValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InPlaceSoftwareUpdateValidation.java
new file mode 100644
index 0000000000..afbacb465d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InPlaceSoftwareUpdateValidation.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+import org.onap.so.serviceinstancebeans.RequestParameters;
+
+public class InPlaceSoftwareUpdateValidation implements ValidationRule{
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+ @Override
+ public ValidationInformation validate(ValidationInformation info) throws ValidationException{
+ RequestParameters requestParameters = info.getSir().getRequestDetails().getRequestParameters();
+ CloudConfiguration cloudConfiguration = info.getSir().getRequestDetails ().getCloudConfiguration();
+ RequestInfo requestInfo = info.getSir().getRequestDetails().getRequestInfo();
+
+ 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");
+ }
+ return info;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java
new file mode 100644
index 0000000000..a42a13c676
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java
@@ -0,0 +1,81 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import java.util.HashMap;
+
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.utils.UUIDChecker;
+
+public class InstanceIdMapValidation implements ValidationRule{
+
+ @Override
+ public ValidationInformation validate(ValidationInformation info) throws ValidationException{
+ HashMap<String, String> instanceIdMap = info.getInstanceIdMap();
+ ServiceInstancesRequest sir = info.getSir();
+ if(instanceIdMap != null){
+ if(instanceIdMap.get("serviceInstanceId") != null){
+ if (!UUIDChecker.isValidUUID (instanceIdMap.get ("serviceInstanceId"))) {
+ throw new ValidationException ("serviceInstanceId");
+ }
+ sir.setServiceInstanceId(instanceIdMap.get("serviceInstanceId"));
+ }
+
+ if(instanceIdMap.get("vnfInstanceId") != null){
+ if (!UUIDChecker.isValidUUID (instanceIdMap.get ("vnfInstanceId"))) {
+ throw new ValidationException ("vnfInstanceId");
+ }
+ sir.setVnfInstanceId(instanceIdMap.get("vnfInstanceId"));
+ }
+
+ if(instanceIdMap.get("vfModuleInstanceId") != null){
+ if (!UUIDChecker.isValidUUID (instanceIdMap.get ("vfModuleInstanceId"))) {
+ throw new ValidationException ("vfModuleInstanceId");
+ }
+ sir.setVfModuleInstanceId(instanceIdMap.get("vfModuleInstanceId"));
+ }
+
+ if(instanceIdMap.get("volumeGroupInstanceId") != null){
+ if (!UUIDChecker.isValidUUID (instanceIdMap.get ("volumeGroupInstanceId"))) {
+ throw new ValidationException ("volumeGroupInstanceId");
+ }
+ sir.setVolumeGroupInstanceId(instanceIdMap.get("volumeGroupInstanceId"));
+ }
+
+ if(instanceIdMap.get("networkInstanceId") != null){
+ if (!UUIDChecker.isValidUUID (instanceIdMap.get ("networkInstanceId"))) {
+ throw new ValidationException ("networkInstanceId");
+ }
+ sir.setNetworkInstanceId(instanceIdMap.get("networkInstanceId"));
+ }
+
+ if(instanceIdMap.get("configurationInstanceId") != null){
+ if (!UUIDChecker.isValidUUID (instanceIdMap.get ("configurationInstanceId"))) {
+ throw new ValidationException ("configurationInstanceId");
+ }
+ sir.setConfigurationId(instanceIdMap.get("configurationInstanceId"));
+ }
+ }
+ return info;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ModelInfoValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ModelInfoValidation.java
new file mode 100644
index 0000000000..8ab7fccdff
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ModelInfoValidation.java
@@ -0,0 +1,111 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestParameters;
+import org.onap.so.utils.UUIDChecker;
+public class ModelInfoValidation implements ValidationRule{
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+ @Override
+ public ValidationInformation validate(ValidationInformation info) throws ValidationException{
+ ModelInfo modelInfo = info.getSir().getRequestDetails().getModelInfo();
+ RequestParameters requestParameters = info.getReqParameters();
+ String requestScope = info.getRequestScope();
+ Actions action = info.getAction();
+ int reqVersion = info.getReqVersion();
+ Boolean aLaCarteFlag = info.getALaCarteFlag();
+
+ if(!empty(modelInfo.getModelNameVersionId())){
+ modelInfo.setModelVersionId(modelInfo.getModelNameVersionId());
+ }
+ // 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 ()) && ((reqVersion >2 && (aLaCarteFlag != null && !aLaCarteFlag) && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) ||
+ !(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(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())) &&
+ (!(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 (reqVersion >= 4 && empty (modelInfo.getModelVersionId()) && (((aLaCarteFlag != null && !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(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");
+ }
+ return info;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java
new file mode 100644
index 0000000000..7c51f3e5ce
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java
@@ -0,0 +1,60 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.apihandlerinfra.ModelType;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.LineOfBusiness;
+import org.onap.so.serviceinstancebeans.Platform;
+
+public class PlatformLOBValidation implements ValidationRule{
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+ @Override
+ public ValidationInformation validate(ValidationInformation info) throws ValidationException{
+ int reqVersion = info.getReqVersion();
+ Platform platform;
+ LineOfBusiness lineOfBusiness;
+ String requestScope = info.getRequestScope();
+ Actions action = info.getAction();
+
+ platform = info.getSir().getRequestDetails().getPlatform();
+ lineOfBusiness = info.getSir().getRequestDetails().getLineOfBusiness();
+ if(reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.createInstance){
+ if(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");
+ }
+ }
+ info.setPlatform(platform);
+ info.setLOB(lineOfBusiness);
+ return info;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java
new file mode 100644
index 0000000000..f6a3c03555
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java
@@ -0,0 +1,60 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.apihandlerinfra.ModelType;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.OwningEntity;
+import org.onap.so.serviceinstancebeans.Project;
+
+public class ProjectOwningEntityValidation implements ValidationRule{
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+ @Override
+ public ValidationInformation validate(ValidationInformation info) throws ValidationException{
+ int reqVersion = info.getReqVersion();
+ Project project;
+ OwningEntity owningEntity;
+ String requestScope = info.getRequestScope();
+ Actions action = info.getAction();
+
+ project = info.getSir().getRequestDetails().getProject();
+ owningEntity = info.getSir().getRequestDetails().getOwningEntity();
+ if(reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.createInstance || action == Action.assignInstance){
+ if(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");
+ }
+ }
+ info.setProject(project);
+ info.setOE(owningEntity);
+ return info;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java
new file mode 100644
index 0000000000..096b30939b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java
@@ -0,0 +1,232 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.serviceinstancebeans.InstanceDirection;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RelatedInstance;
+import org.onap.so.serviceinstancebeans.RelatedInstanceList;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.utils.UUIDChecker;
+
+public class RelatedInstancesValidation implements ValidationRule{
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+ @Override
+ public ValidationInformation validate(ValidationInformation info) throws ValidationException{
+ ServiceInstancesRequest sir = info.getSir();
+ Actions action = info.getAction();
+ int reqVersion = info.getReqVersion();
+ String requestScope = info.getRequestScope();
+ String serviceInstanceType = null;
+ String networkType = null;
+ String vnfType = null;
+ String vfModuleType = null;
+ String vfModuleModelName = null;
+ ModelInfo modelInfo = info.getSir().getRequestDetails().getModelInfo();
+ MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, RelatedInstancesValidation.class);
+ 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(requestScope.equalsIgnoreCase(ModelType.service.name())){
+ serviceInstanceType = modelInfo.getModelName();
+ info.setServiceInstanceType(serviceInstanceType);
+ }
+ if(requestScope.equalsIgnoreCase(ModelType.network.name())){
+ networkType = modelInfo.getModelName();
+ info.setNetworkType(networkType);
+ }
+ 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) ||
+ relatedInstanceModelInfo.getModelType().equals(ModelType.networkCollection))) {
+
+ if(empty (relatedInstanceModelInfo.getModelInvariantId ())) {
+ throw new ValidationException ("modelInvariantId in relatedInstance");
+ } else if(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) && 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(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 (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 (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");
+ }
+ serviceInstanceType = serviceModelName;
+ vnfType = serviceModelName + "/" + vnfModelName;
+ info.setServiceInstanceType(serviceInstanceType);
+ info.setVnfType(vnfType);
+ }
+ 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");
+ }
+ vfModuleModelName = modelInfo.getModelName ();
+ serviceInstanceType = serviceModelName;
+ vnfType = serviceModelName + "/" + vnfModelName;
+ vfModuleType = vnfType + "::" + vfModuleModelName;
+ sir.setVolumeGroupInstanceId (volumeGroupId);
+ info.setVfModuleModelName(vfModuleModelName);
+ info.setVnfType(vnfType);
+ info.setServiceInstanceType(serviceInstanceType);
+ info.setVfModuleType(vfModuleType);
+ }
+ else if (requestScope.equalsIgnoreCase (ModelType.vnf.name ())) {
+ if (!isRelatedServiceInstancePresent) {
+ throw new ValidationException ("related service instance for vnf request");
+ }
+ vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName();
+ info.setVnfType(vnfType);
+ }
+ }
+ 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)) ||
+ (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");
+ }
+ info.setVfModuleModelName(vfModuleModelName);
+ info.setServiceInstanceType(serviceInstanceType);
+ info.setVnfType(vnfType);
+ info.setAsdcServiceModelVersion(asdcServiceModelVersion);
+ info.setVfModuleType(vfModuleType);
+ return info;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestInfoValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestInfoValidation.java
new file mode 100644
index 0000000000..bdc9649ecc
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestInfoValidation.java
@@ -0,0 +1,67 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+
+public class RequestInfoValidation implements ValidationRule{
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+ @Override
+ public ValidationInformation validate(ValidationInformation info) throws ValidationException{
+ RequestInfo requestInfo = info.getSir().getRequestDetails().getRequestInfo();
+ int reqVersion = info.getReqVersion();
+ String requestScope = info.getRequestScope();
+ Actions action = info.getAction();
+ Boolean aLaCarteFlag = info.getALaCarteFlag();
+
+ //required for all operations in V4
+ if(empty(requestInfo.getRequestorId()) && reqVersion >= 4) {
+ throw new ValidationException ("requestorId");
+ }
+
+ if (empty (requestInfo.getSource ())) {
+ throw new ValidationException ("source");
+ }
+ 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)) ||
+ (reqVersion > 3 && (aLaCarteFlag != null && !aLaCarteFlag) && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.createInstance)) {
+ throw new ValidationException ("productFamilyId");
+ }
+ }
+ return info;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java
new file mode 100644
index 0000000000..c717999fbd
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java
@@ -0,0 +1,100 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import java.util.Map;
+
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestParameters;
+
+public class RequestParametersValidation implements ValidationRule{
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+ @Override
+ public ValidationInformation validate(ValidationInformation info) throws ValidationException{
+ int reqVersion = info.getReqVersion();
+ String requestScope = info.getRequestScope();
+ Actions action = info.getAction();
+ RequestParameters requestParameters = info.getReqParameters();
+
+ if (requestScope.equalsIgnoreCase(ModelType.service.name()) && (action == Action.createInstance || action == Action.assignInstance)) {
+ if (requestParameters == null) {
+ throw new ValidationException ("requestParameters");
+ }
+ if (empty (requestParameters.getSubscriptionServiceType())) {
+ throw new ValidationException ("subscriptionServiceType");
+ }
+ }
+ if(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 && !requestScope.equalsIgnoreCase(ModelType.service.name())){
+ info.setALaCarteFlag(true);
+ }
+ if(requestParameters != null){
+ if(requestScope.equalsIgnoreCase(ModelType.vnf.name())){
+ if(action == Action.updateInstance){
+ if(requestParameters.isUsePreload() == null){
+ requestParameters.setUsePreload(true);
+ }
+ }
+ if(action == Action.replaceInstance){
+ if(requestParameters.getRebuildVolumeGroups() == 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(reqVersion >= 4){
+ if(requestParameters.getALaCarte() != null){
+ info.setALaCarteFlag(requestParameters.getALaCarte());
+ }else 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);
+ info.setALaCarteFlag(requestParameters.getALaCarte());
+ }
+ }
+ }else{
+ info.setALaCarteFlag(true);
+ }
+ }else{
+ info.setALaCarteFlag(true);
+ }
+ }
+ return info;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestScopeValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestScopeValidation.java
new file mode 100644
index 0000000000..51a9afe200
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestScopeValidation.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+
+public class RequestScopeValidation implements ValidationRule{
+ @Override
+ public ValidationInformation validate(ValidationInformation info) throws ValidationException{
+ ModelInfo modelInfo = info.getSir().getRequestDetails().getModelInfo();
+ RequestInfo requestInfo = info.getSir().getRequestDetails().getRequestInfo();
+ String requestScope;
+
+ if (modelInfo == null) {
+ throw new ValidationException ("model-info");
+ }
+ if (requestInfo == null) {
+ throw new ValidationException ("requestInfo");
+ }
+ info.setRequestInfo(requestInfo);
+ if (modelInfo.getModelType () == null) {
+ throw new ValidationException ("modelType");
+ }
+ requestScope = info.getSir().getRequestDetails().getModelInfo().getModelType().name();
+ info.setRequestScope(requestScope);
+ return info;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/SubscriberInfoValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/SubscriberInfoValidation.java
new file mode 100644
index 0000000000..d9298f5f4e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/SubscriberInfoValidation.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.SubscriberInfo;
+
+public class SubscriberInfoValidation implements ValidationRule{
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+ @Override
+ public ValidationInformation validate(ValidationInformation info) throws ValidationException{
+ String requestScope = info.getRequestScope();
+ int reqVersion = info.getReqVersion();
+ Actions action = info.getAction();
+
+ if (reqVersion > 4 && requestScope.equalsIgnoreCase (ModelType.service.name ()) && action == Action.createInstance || action == Action.assignInstance) {
+ SubscriberInfo subscriberInfo = info.getSir().getRequestDetails ().getSubscriberInfo();
+ if (subscriberInfo == null) {
+ throw new ValidationException ("subscriberInfo");
+ }
+ if (empty (subscriberInfo.getGlobalSubscriberId ())) {
+ throw new ValidationException ("globalSubscriberId");
+ }
+ }
+ return info;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java
new file mode 100644
index 0000000000..da1f1f6e90
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java
@@ -0,0 +1,102 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.Networks;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.VfModules;
+import org.onap.so.serviceinstancebeans.Vnfs;
+
+public class UserParamsValidation implements ValidationRule{
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+ @Override
+ public ValidationInformation validate(ValidationInformation info) throws ValidationException{
+ Service validate = info.getUserParams();
+ Actions action = info.getAction();
+
+ if(validate.getModelInfo() == null){
+ throw new ValidationException ("model-info in userParams");
+ }else if(validate.getModelInfo().getModelVersionId() == null){
+ throw new ValidationException("modelVersionId in userParams");
+ }
+ for(Vnfs vnf : validate.getResources().getVnfs()){
+ if(vnf.getModelInfo() == null){
+ throw new ValidationException ("model-info in userParams vnf resources");
+ }else if(vnf.getModelInfo().getModelCustomizationId() == null){
+ throw new ValidationException ("modelCustomizationId in userParams vnf resources");
+ }else if(vnf.getModelInfo().getModelVersionId() == null){
+ throw new ValidationException("modelVersionId in userParams vnf resources");
+ }
+ if(vnf.getCloudConfiguration() == null){
+ throw new ValidationException ("cloudConfiguration in userParams vnf resources");
+ }
+ if(action == Action.createInstance || action == Action.assignInstance){
+ if(vnf.getPlatform() == null){
+ throw new ValidationException ("platform in userParams vnf resources");
+ }if(vnf.getProductFamilyId() == null){
+ throw new ValidationException ("productFamilyId in userParams vnf resources");
+ }
+ }
+ if (vnf.getPlatform() != null && vnf.getPlatform().getPlatformName() == null){
+ throw new ValidationException ("platformName in userParams vnf resources");
+ }
+ if(vnf.getVfModules().isEmpty()){
+ throw new ValidationException ("vfModules in userParams vnf resources");
+ }
+ for(VfModules vfModules : vnf.getVfModules()){
+ if(vfModules.getModelInfo() == null){
+ throw new ValidationException ("model-info in userParams vfModules resources");
+ }else if(vfModules.getModelInfo().getModelCustomizationId() == null){
+ throw new ValidationException ("modelCustomizationId in userParams vfModule resources");
+ }else if(vfModules.getModelInfo().getModelVersionId() == null){
+ throw new ValidationException("modelVersionId in userParams vfModule resources");
+ }
+ }
+ }
+
+ List<Networks> validateNetworks = new ArrayList<>();
+ validateNetworks = validate.getResources().getNetworks();
+ if(validateNetworks != null){
+ for(Networks networks : validateNetworks){
+ if(networks.getModelInfo() == null){
+ throw new ValidationException ("model-info in userParams network resources");
+ }else if(networks.getModelInfo().getModelCustomizationId() == null){
+ throw new ValidationException ("modelCustomizationId in userParams network resources");
+ }else if(networks.getModelInfo().getModelVersionId() == null){
+ throw new ValidationException("modelVersionId in userParams network resources");
+ }
+ if(networks.getCloudConfiguration() == null){
+ throw new ValidationException ("cloudConfiguration in userParams network resources");
+ }
+ }
+ }
+ return info;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationInformation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationInformation.java
new file mode 100644
index 0000000000..7fc9567123
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationInformation.java
@@ -0,0 +1,180 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import java.util.HashMap;
+
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.serviceinstancebeans.LineOfBusiness;
+import org.onap.so.serviceinstancebeans.OwningEntity;
+import org.onap.so.serviceinstancebeans.Platform;
+import org.onap.so.serviceinstancebeans.Project;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+import org.onap.so.serviceinstancebeans.RequestParameters;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+public class ValidationInformation{
+ ServiceInstancesRequest sir;
+ HashMap<String,String> instanceIdMap;
+ Actions action;
+ int reqVersion;
+ String requestScope;
+ Boolean aLaCarteFlag;
+ RequestParameters requestParameters;
+ RequestInfo requestInfo;
+ String serviceInstanceType;
+ String vfModuleModelName;
+ String vnfType;
+ String asdcServiceModelVersion;
+ String vfModuleType;
+ String networkType;
+ Platform platform;
+ LineOfBusiness lob;
+ Project project;
+ OwningEntity owningEntity;
+ Service userParams;
+
+ public ValidationInformation(ServiceInstancesRequest sir, HashMap<String,String> instanceIdMap,
+ Actions action, int reqVersion, Boolean aLaCarteFlag, RequestParameters requestParameters){
+ this.sir = sir;
+ this.instanceIdMap = instanceIdMap;
+ this.action = action;
+ this.reqVersion = reqVersion;
+ this.aLaCarteFlag = aLaCarteFlag;
+ this.requestParameters = requestParameters;
+ }
+ public ServiceInstancesRequest getSir(){
+ return this.sir;
+ }
+ public void setSir(ServiceInstancesRequest value){
+ this.sir = value;
+ }
+ public HashMap<String, String> getInstanceIdMap(){
+ return this.instanceIdMap;
+ }
+ public void setInstanceIdMap(HashMap<String, String> value){
+ this.instanceIdMap = value;
+ }
+ public Actions getAction(){
+ return this.action;
+ }
+ public void setAction(Actions value){
+ this.action = value;
+ }
+ public RequestInfo getRequestInfo(){
+ return this.requestInfo;
+ }
+ public void setRequestInfo(RequestInfo value){
+ this.requestInfo = value;
+ }
+ public int getReqVersion(){
+ return this.reqVersion;
+ }
+ public void setReqVersion(int value){
+ this.reqVersion = value;
+ }
+ public String getRequestScope(){
+ return this.requestScope;
+ }
+ public void setRequestScope(String value){
+ this.requestScope = value;
+ }
+ public Boolean getALaCarteFlag(){
+ return this.aLaCarteFlag;
+ }
+ public void setALaCarteFlag(Boolean value){
+ this.aLaCarteFlag = value;
+ }
+ public RequestParameters getReqParameters(){
+ return this.requestParameters;
+ }
+ public void setReqParameters(RequestParameters value){
+ this.requestParameters = value;
+ }
+ public String getServiceInstanceType(){
+ return this.serviceInstanceType;
+ }
+ public void setServiceInstanceType(String value){
+ this.serviceInstanceType = value;
+ }
+ public String getVfModuleModelName(){
+ return this.vfModuleModelName;
+ }
+ public void setVfModuleModelName(String value){
+ this.vfModuleModelName = value;
+ }
+ public String getVnfType(){
+ return this.vnfType;
+ }
+ public void setVnfType(String value){
+ this.vnfType = value;
+ }
+ public String getAsdcServiceModelVersion(){
+ return this.asdcServiceModelVersion;
+ }
+ public void setAsdcServiceModelVersion(String value){
+ this.asdcServiceModelVersion = value;
+ }
+ public String getVfModuleType(){
+ return this.vfModuleType;
+ }
+ public void setVfModuleType(String value){
+ this.vfModuleType = value;
+ }
+ public String getNetworkType(){
+ return this.networkType;
+ }
+ public void setNetworkType(String value){
+ this.networkType = value;
+ }
+ public Platform getPlatform(){
+ return this.platform;
+ }
+ public void setPlatform(Platform value){
+ this.platform = value;
+ }
+ public LineOfBusiness getLOB(){
+ return this.lob;
+ }
+ public void setLOB(LineOfBusiness value){
+ this.lob = value;
+ }
+ public Project getProject(){
+ return this.project;
+ }
+ public void setProject(Project value){
+ this.project = value;
+ }
+ public OwningEntity getOE(){
+ return this.owningEntity;
+ }
+ public void setOE(OwningEntity value){
+ this.owningEntity = value;
+ }
+ public Service getUserParams(){
+ return this.userParams;
+ }
+ public void setUserParams(Service value){
+ this.userParams = value;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationRule.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationRule.java
new file mode 100644
index 0000000000..a5d85f6533
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationRule.java
@@ -0,0 +1,28 @@
+/*-
+ * ============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.onap.so.apihandlerinfra.validation;
+
+import org.onap.so.exceptions.ValidationException;
+
+public interface ValidationRule{
+ ValidationInformation validate(ValidationInformation info)throws ValidationException;
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ActionType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ActionType.java
new file mode 100644
index 0000000000..15fe0a5be3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ActionType.java
@@ -0,0 +1,80 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.apihandlerinfra.vnfbeans;
+
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for action-type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="action-type">
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * &lt;enumeration value="CREATE"/>
+ * &lt;enumeration value="SETSTATUS"/>
+ * &lt;enumeration value="REPLACE"/>
+ * &lt;enumeration value="UPDATE"/>
+ * &lt;enumeration value="DELETE"/>
+ * &lt;enumeration value="CREATE_VF_MODULE"/>
+ * &lt;enumeration value="UPDATE_VF_MODULE"/>
+ * &lt;enumeration value="DELETE_VF_MODULE"/>
+ * &lt;enumeration value="NOT_PROVIDED"/>
+ * &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ *
+ */
+@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/onap/so/apihandlerinfra/vnfbeans/ModelType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ModelType.java
new file mode 100644
index 0000000000..3f708c49d5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ModelType.java
@@ -0,0 +1,32 @@
+/*-
+ * ============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.onap.so.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/onap/so/apihandlerinfra/vnfbeans/ObjectFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ObjectFactory.java
new file mode 100644
index 0000000000..72be61105b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ObjectFactory.java
@@ -0,0 +1,150 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.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.onap.so.apihandlerinfra.vnfbeans1 package.
+ * <p>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.onap/so/infra/vnf-request/v1", "vnf-params");
+ private final static QName _NetworkParams_QNAME = new QName("http://org.onap/so/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.onap.so.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.onap/so/infra/vnf-request/v1", name = "vnf-params")
+ public JAXBElement<Object> 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/onap/so/apihandlerinfra/vnfbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/RequestInfo.java
new file mode 100644
index 0000000000..dc8457c6a4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/RequestInfo.java
@@ -0,0 +1,286 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.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;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="request-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="action" type="{http://org.onap/so/infra/vnf-request/v1}action-type"/>
+ * &lt;element name="request-status" type="{http://org.onap/so/infra/vnf-request/v1}request-status-type" minOccurs="0"/>
+ * &lt;element name="status-message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="progress" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ * &lt;element name="start-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="end-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@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 String 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 String getProgress() {
+ return progress;
+ }
+
+ /**
+ * Sets the value of the progress property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setProgress(String 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/onap/so/apihandlerinfra/vnfbeans/RequestStatusType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/RequestStatusType.java
new file mode 100644
index 0000000000..8c98b9f801
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/RequestStatusType.java
@@ -0,0 +1,71 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.apihandlerinfra.vnfbeans;
+
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for request-status-type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="request-status-type">
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * &lt;enumeration value="COMPLETE"/>
+ * &lt;enumeration value="FAILED"/>
+ * &lt;enumeration value="IN_PROGRESS"/>
+ * &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ *
+ */
+@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/onap/so/apihandlerinfra/vnfbeans/VfModuleModelName.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VfModuleModelName.java
new file mode 100644
index 0000000000..74065482f8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VfModuleModelName.java
@@ -0,0 +1,261 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.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;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="model-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="model-version" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="model-invariant-uuid" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="is-base" type="{http://www.w3.org/2001/XMLSchema}Boolean"/>
+ * &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="asdc-service-model-version" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@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/onap/so/apihandlerinfra/vnfbeans/VfModuleModelNames.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VfModuleModelNames.java
new file mode 100644
index 0000000000..9904884620
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VfModuleModelNames.java
@@ -0,0 +1,104 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.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;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://org.onap/so/infra/vnf-request/v1}vf-module-model-name" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@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> vfModuleModelName;
+
+ /**
+ * Gets the value of the vfModuleModelName property.
+ *
+ * <p>
+ * 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 <CODE>set</CODE> method for the vnfType property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getVfModuleModelName().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link VfModuleModelName }
+ *
+ *
+ */
+ public List<VfModuleModelName> getVfModuleModelName() {
+ if (vfModuleModelName == null) {
+ vfModuleModelName = new ArrayList<>();
+ }
+ return this.vfModuleModelName;
+ }
+
+ public void setVfModuleModelName(List<VfModuleModelName> vfModuleModelName) {
+ this.vfModuleModelName=vfModuleModelName;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfInputs.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfInputs.java
new file mode 100644
index 0000000000..8816d0d4fc
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfInputs.java
@@ -0,0 +1,689 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.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;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="vnf-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vf-module-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vnf-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vf-module-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vnf-type" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vf-module-model-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="asdc-service-model-version" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="service-instance-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="backout-on-failure" type="{http://www.w3.org/2001/XMLSchema}Boolean"/>
+ * &lt;choice>
+ * &lt;element name="service-type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="service-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/choice>
+ * &lt;choice>
+ * &lt;element name="aic-node-clli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="aic-cloud-region" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/choice>
+ * &lt;element name="tenant-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="prov-status" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="volume-group-name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="volume-group-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="persona-model-id" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
+ * &lt;element name="persona-model-version" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
+ * &lt;element name="is-base-vf-module" type="{http://www.w3.org/2001/XMLSchema}Boolean"/ minOccurs="0">
+ * &lt;element name="vnf-persona-model-id" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
+ * &lt;element name="vnf-persona-model-version" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@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/onap/so/apihandlerinfra/vnfbeans/VnfOutputs.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfOutputs.java
new file mode 100644
index 0000000000..114a3ae137
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfOutputs.java
@@ -0,0 +1,291 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.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;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="vnf-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vf-module-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vnf-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="vf-module-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="aic-node-clli" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="tenant-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="volume-group-name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="volume-group-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@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/onap/so/apihandlerinfra/vnfbeans/VnfRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfRequest.java
new file mode 100644
index 0000000000..07b186e149
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfRequest.java
@@ -0,0 +1,179 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.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;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://org.onap/so/infra/vnf-request/v1}request-info"/>
+ * &lt;sequence>
+ * &lt;element ref="{http://org.onap/so/infra/vnf-request/v1}vnf-inputs"/>
+ * &lt;element ref="{http://org.onap/so/infra/vnf-request/v1}vnf-params" minOccurs="0"/>
+ * &lt;element ref="{http://org.onap/so/infra/vnf-request/v1}vnf-outputs" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@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/onap/so/apihandlerinfra/vnfbeans/VnfRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfRequests.java
new file mode 100644
index 0000000000..caa0cae84d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfRequests.java
@@ -0,0 +1,103 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.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;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://org.onap/so/infra/vnf-request/v1}vnf-request" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "vnfRequest"
+})
+@XmlRootElement(name = "vnf-requests")
+public class VnfRequests {
+
+ @XmlElement(name = "vnf-request")
+ protected List<VnfRequest> vnfRequest;
+
+ /**
+ * Gets the value of the vnfRequest property.
+ *
+ * <p>
+ * 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 <CODE>set</CODE> method for the vnfRequest property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getVnfRequest().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link VnfRequest }
+ *
+ *
+ */
+ public List<VnfRequest> getVnfRequest() {
+ if (vnfRequest == null) {
+ vnfRequest = new ArrayList<>();
+ }
+ return this.vnfRequest;
+ }
+
+ public void setVnfRequest(List<VnfRequest> vnfRequest) {
+ this.vnfRequest=vnfRequest;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfType.java
new file mode 100644
index 0000000000..dd556a7c34
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfType.java
@@ -0,0 +1,148 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.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;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="type" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@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/onap/so/apihandlerinfra/vnfbeans/VnfTypes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfTypes.java
new file mode 100644
index 0000000000..6728c69172
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfTypes.java
@@ -0,0 +1,104 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap.so.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;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://org.onap/so/infra/vnf-request/v1}vnf-type" maxOccurs="unbounded" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "vnfType"
+})
+@XmlRootElement(name = "vnf-types")
+public class VnfTypes {
+
+ @XmlElement(name = "vnf-type")
+ protected List<VnfType> vnfType;
+
+ /**
+ * Gets the value of the vnfType property.
+ *
+ * <p>
+ * 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 <CODE>set</CODE> method for the vnfType property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getVnfType().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link VnfType }
+ *
+ *
+ */
+ public List<VnfType> getVnfType() {
+ if (vnfType == null) {
+ vnfType = new ArrayList<>();
+ }
+ return this.vnfType;
+ }
+
+ public void setVnfType( List<VnfType> vnfType) {
+ this.vnfType=vnfType;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/package-info.java
new file mode 100644
index 0000000000..3eb84299f4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/package-info.java
@@ -0,0 +1,30 @@
+/*-
+ * ============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 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// 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.onap/so/infra/vnf-request/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.onap.so.apihandlerinfra.vnfbeans;
+