From 5a6a6de6f1a26a1897e4917a0df613e25a24eb70 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Mon, 30 Jul 2018 15:56:09 -0400 Subject: Containerization feature of SO Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) --- mso-api-handlers/mso-api-handler-common/pom.xml | 144 +- .../beans/avpnbondingbeans/AVPNServiceNames.java | 44 + .../so/apihandler/camundabeans/BpmnRequest.java | 252 +++ .../camundabeans/CamundaBooleanInput.java | 72 + .../camundabeans/CamundaBpmnRequestInput.java | 71 + .../so/apihandler/camundabeans/CamundaInput.java | 76 + .../camundabeans/CamundaIntegerInput.java | 71 + .../camundabeans/CamundaMacroRequest.java | 107 ++ .../CamundaMacroRequestSerializer.java | 50 + .../so/apihandler/camundabeans/CamundaRequest.java | 135 ++ .../apihandler/camundabeans/CamundaResponse.java | 96 ++ .../apihandler/camundabeans/CamundaVIDRequest.java | 338 ++++ .../org/onap/so/apihandler/camundabeans/Track.java | 49 + .../onap/so/apihandler/common/CamundaClient.java | 278 ++++ .../so/apihandler/common/CamundaTaskClient.java | 93 ++ .../onap/so/apihandler/common/CommonConstants.java | 88 ++ .../onap/so/apihandler/common/ErrorNumbers.java | 77 + .../org/onap/so/apihandler/common/LSInputImpl.java | 119 ++ .../so/apihandler/common/PathResourceResolver.java | 63 + .../onap/so/apihandler/common/RequestClient.java | 102 ++ .../so/apihandler/common/RequestClientFactory.java | 68 + .../apihandler/common/RequestClientParameter.java | 279 ++++ .../onap/so/apihandler/common/ResponseHandler.java | 221 +++ .../onap/so/apihandler/common/XMLValidator.java | 103 ++ .../recipe/CamundaClientErrorHandler.java | 51 + .../java/org/onap/so/apihandlerinfra/Action.java | 45 + .../org/onap/so/apihandlerinfra/Constants.java | 52 + .../java/org/onap/so/apihandlerinfra/Messages.java | 56 + .../org/onap/so/apihandlerinfra/ModelType.java | 32 + .../org/onap/so/apihandlerinfra/MsoException.java | 26 + .../java/org/onap/so/apihandlerinfra/Status.java | 36 + .../apihandlerinfra/exceptions/ApiException.java | 125 ++ .../exceptions/ApiExceptionMapper.java | 111 ++ .../exceptions/BPMNFailureException.java | 43 + .../exceptions/ClientConnectionException.java | 46 + .../exceptions/DuplicateRequestException.java | 47 + .../exceptions/RecipeNotFoundException.java | 43 + .../exceptions/ValidateException.java | 43 + .../exceptions/VfModuleNotFoundException.java | 46 + .../apihandlerinfra/logging/AlarmLoggerInfo.java | 84 + .../apihandlerinfra/logging/ErrorLoggerInfo.java | 111 ++ .../mso/apihandler/camundabeans/BpmnRequest.java | 252 --- .../camundabeans/CamundaBooleanInput.java | 60 - .../camundabeans/CamundaBpmnRequestInput.java | 59 - .../mso/apihandler/camundabeans/CamundaInput.java | 66 - .../camundabeans/CamundaIntegerInput.java | 58 - .../apihandler/camundabeans/CamundaRequest.java | 133 -- .../apihandler/camundabeans/CamundaResponse.java | 102 -- .../apihandler/camundabeans/CamundaVIDRequest.java | 300 ---- .../mso/apihandler/camundabeans/Track.java | 49 - .../mso/apihandler/common/BPELRestClient.java | 96 -- .../mso/apihandler/common/CamundaClient.java | 254 --- .../mso/apihandler/common/CamundaTaskClient.java | 93 -- .../mso/apihandler/common/CommonConstants.java | 71 - .../mso/apihandler/common/ErrorNumbers.java | 73 - .../mso/apihandler/common/LSInputImpl.java | 119 -- .../apihandler/common/PathResourceResolver.java | 64 - .../mso/apihandler/common/RequestClient.java | 84 - .../apihandler/common/RequestClientFactory.java | 61 - .../apihandler/common/RequestClientParamater.java | 242 --- .../mso/apihandler/common/ResponseHandler.java | 194 --- .../mso/apihandler/common/ValidationException.java | 48 - .../mso/apihandler/common/XMLValidator.java | 103 -- .../mso/apihandler/common/package-info.java | 25 - .../onap/so/apihandler/camundabeans/BeansTest.java | 72 + .../apihandler/camundabeans/BpmnRequestTest.java | 178 +++ .../CamundaMacroRequestSerializerTest.java | 36 + .../so/apihandler/common/AllTestsTestSuite.java | 33 + .../so/apihandler/common/CamundaClientTest.java | 166 ++ .../apihandler/common/CamundaTaskClientTest.java | 139 ++ .../so/apihandler/common/ResponseHandlerTest.java | 139 ++ .../recipe/CamundaClientErrorHandlerTest.java | 72 + .../so/apihandlerinfra/ApiExceptionMapperTest.java | 97 ++ .../onap/so/apihandlerinfra/ApiExceptionTest.java | 128 ++ .../org/onap/so/apihandlerinfra/TestAppender.java | 37 + .../mso/apihandler/camundabeans/BeansTest.java | 72 - .../apihandler/camundabeans/BpmnRequestTest.java | 178 --- .../apihandler/common/CamundaTaskClientTest.java | 132 -- .../mso/camunda/tests/BPELRestClientTest.java | 125 -- .../mso/camunda/tests/CamundaClientTest.java | 144 -- .../mso/camunda/tests/CamundaRequestTest.java | 81 - .../mso/camunda/tests/CamundaResponseTest.java | 78 - .../mso/camunda/tests/ResponseHandlerTest.java | 137 -- .../CamundaClientTest/WrappedVIDRequest.json | 1 + .../src/test/resources/logback-test.xml | 48 - .../WebContent/META-INF/MANIFEST.MF | 3 - .../WebContent/WEB-INF/beans.xml | 0 .../WEB-INF/jboss-deployment-structure.xml | 23 - .../WebContent/WEB-INF/jboss-web.xml | 6 - .../WebContent/WEB-INF/web.xml | 165 -- .../mso-api-handler-infra/WebContent/check.html | 11 - .../mso-api-handler-infra/WebContent/index.xhtml | 19 - mso-api-handlers/mso-api-handler-infra/pom.xml | 374 ++--- .../onap/so/apihandler/common/ResponseBuilder.java | 61 + .../so/apihandler/filters/RequestUriFilter.java | 58 + .../recipe/CamundaClientErrorHandler.java | 51 + .../java/org/onap/so/apihandlerinfra/Action.java | 46 + .../java/org/onap/so/apihandlerinfra/Actions.java | 25 + .../so/apihandlerinfra/ApiHandlerApplication.java | 70 + .../org/onap/so/apihandlerinfra/Constants.java | 52 + .../so/apihandlerinfra/E2EServiceInstances.java | 1240 +++++++++++++++ .../apihandlerinfra/GlobalHealthcheckHandler.java | 70 + .../so/apihandlerinfra/JerseyConfiguration.java | 76 + .../org/onap/so/apihandlerinfra/ManualTasks.java | 247 +++ .../java/org/onap/so/apihandlerinfra/Messages.java | 56 + .../org/onap/so/apihandlerinfra/ModelType.java | 32 + .../org/onap/so/apihandlerinfra/MsoException.java | 26 + .../org/onap/so/apihandlerinfra/MsoRequest.java | 756 +++++++++ .../so/apihandlerinfra/NodeHealthcheckHandler.java | 68 + .../so/apihandlerinfra/OrchestrationRequests.java | 342 ++++ .../so/apihandlerinfra/RecipeLookupResult.java | 76 + .../onap/so/apihandlerinfra/RequestActionMap.java | 53 + .../onap/so/apihandlerinfra/ServiceInstances.java | 1661 ++++++++++++++++++++ .../so/apihandlerinfra/SpringContextHelper.java | 41 + .../java/org/onap/so/apihandlerinfra/Status.java | 36 + .../org/onap/so/apihandlerinfra/TasksHandler.java | 337 ++++ .../java/org/onap/so/apihandlerinfra/TestApi.java | 37 + .../so/apihandlerinfra/WebSecurityConfigImpl.java | 57 + .../configuration/CatalogDBConfig.java | 80 + .../configuration/RequestDBConfig.java | 78 + .../CompareModelsRequest.java | 68 + .../e2eserviceinstancebeans/DelE2ESvcResp.java | 37 + .../e2eserviceinstancebeans/E2EParameters.java | 83 + .../e2eserviceinstancebeans/E2ERequest.java | 113 ++ .../e2eserviceinstancebeans/E2EService.java | 120 ++ .../E2EServiceInstanceDeleteRequest.java | 46 + .../E2EServiceInstanceRequest.java | 61 + .../E2EServiceInstanceScaleRequest.java | 35 + .../e2eserviceinstancebeans/E2EUserParam.java | 69 + .../GetE2EServiceInstanceResponse.java | 49 + .../LocationConstraint.java | 76 + .../e2eserviceinstancebeans/NsParameters.java | 68 + .../e2eserviceinstancebeans/ResourceRequest.java | 102 ++ .../ScaleNsByStepsData.java | 54 + .../e2eserviceinstancebeans/ScaleNsData.java | 34 + .../e2eserviceinstancebeans/ScaleResource.java | 54 + .../e2eserviceinstancebeans/ScaleService.java | 66 + .../e2eserviceinstancebeans/VimLocation.java | 45 + .../org/onap/so/apihandlerinfra/package-info.java | 30 + .../apihandlerinfra/tasksbeans/RequestDetails.java | 55 + .../so/apihandlerinfra/tasksbeans/RequestInfo.java | 73 + .../so/apihandlerinfra/tasksbeans/TaskList.java | 333 ++++ .../tasksbeans/TaskRequestReference.java | 56 + .../tasksbeans/TaskVariableValue.java | 107 ++ .../apihandlerinfra/tasksbeans/TaskVariables.java | 39 + .../tasksbeans/TasksGetResponse.java | 36 + .../apihandlerinfra/tasksbeans/TasksRequest.java | 34 + .../apihandlerinfra/tasksbeans/ValidResponses.java | 52 + .../onap/so/apihandlerinfra/tasksbeans/Value.java | 55 + .../so/apihandlerinfra/tasksbeans/Variables.java | 74 + .../tenantisolation/AaiClientPropertiesImpl.java | 68 + .../tenantisolation/CloudOrchestration.java | 238 +++ .../tenantisolation/CloudOrchestrationRequest.java | 81 + .../CloudResourcesOrchestration.java | 297 ++++ .../tenantisolation/GrmClientPropertiesImpl.java | 76 + .../tenantisolation/ModelDistributionRequest.java | 156 ++ .../tenantisolation/TenantIsolationRequest.java | 461 ++++++ .../tenantisolation/TenantIsolationRunnable.java | 103 ++ .../dmaap/CreateEcompOperationEnvironmentBean.java | 162 ++ .../dmaap/DmaapOperationalEnvClient.java | 81 + .../tenantisolation/dmaap/DmaapPropertiesImpl.java | 55 + .../dmaap/OperationalEnvironmentPublisher.java | 61 + .../exceptions/AAIClientCallFailed.java | 29 + .../exceptions/SDCClientCallFailed.java | 36 + .../exceptions/TenantIsolationException.java | 36 + .../tenantisolation/helpers/AAIClientHelper.java | 120 ++ .../helpers/AAIClientObjectBuilder.java | 42 + .../helpers/ActivateVnfDBHelper.java | 118 ++ .../tenantisolation/helpers/SDCClientHelper.java | 236 +++ .../process/ActivateVnfOperationalEnvironment.java | 183 +++ .../ActivateVnfStatusOperationalEnvironment.java | 300 ++++ .../process/CreateEcompOperationalEnvironment.java | 83 + .../process/CreateVnfOperationalEnvironment.java | 227 +++ .../DeactivateVnfOperationalEnvironment.java | 89 ++ .../tenantisolationbeans/Action.java | 28 + .../CloudOrchestrationRequestList.java | 37 + .../CloudOrchestrationResponse.java | 38 + .../tenantisolationbeans/Distribution.java | 50 + .../tenantisolationbeans/DistributionStatus.java | 26 + .../tenantisolationbeans/InstanceReferences.java | 60 + .../tenantisolationbeans/Manifest.java | 53 + .../OperationalEnvironment.java | 27 + .../tenantisolationbeans/RecoveryAction.java | 28 + .../tenantisolationbeans/RelatedInstance.java | 68 + .../tenantisolationbeans/RelatedInstanceList.java | 45 + .../tenantisolationbeans/Request.java | 90 ++ .../tenantisolationbeans/RequestDetails.java | 104 ++ .../tenantisolationbeans/RequestInfo.java | 118 ++ .../tenantisolationbeans/RequestList.java | 93 ++ .../tenantisolationbeans/RequestParameters.java | 84 + .../tenantisolationbeans/RequestReferences.java | 96 ++ .../tenantisolationbeans/RequestStatus.java | 69 + .../tenantisolationbeans/ResourceType.java | 26 + .../tenantisolationbeans/ServiceModelList.java | 59 + .../tenantisolationbeans/Status.java | 26 + .../TenantIsolationRequest.java | 95 ++ .../TenantIsolationResponse.java | 115 ++ .../tenantisolationbeans/TenantSyncResponse.java | 35 + .../tenantisolationbeans/package-info.java | 29 + .../validation/ApplyUpdatedConfigValidation.java | 49 + .../validation/CloudConfigurationValidation.java | 75 + .../InPlaceSoftwareUpdateValidation.java | 58 + .../validation/InstanceIdMapValidation.java | 81 + .../validation/ModelInfoValidation.java | 111 ++ .../validation/PlatformLOBValidation.java | 60 + .../validation/ProjectOwningEntityValidation.java | 60 + .../validation/RelatedInstancesValidation.java | 232 +++ .../validation/RequestInfoValidation.java | 67 + .../validation/RequestParametersValidation.java | 100 ++ .../validation/RequestScopeValidation.java | 49 + .../validation/SubscriberInfoValidation.java | 51 + .../validation/UserParamsValidation.java | 102 ++ .../validation/ValidationInformation.java | 180 +++ .../apihandlerinfra/validation/ValidationRule.java | 28 + .../so/apihandlerinfra/vnfbeans/ActionType.java | 80 + .../so/apihandlerinfra/vnfbeans/ModelType.java | 32 + .../so/apihandlerinfra/vnfbeans/ObjectFactory.java | 150 ++ .../so/apihandlerinfra/vnfbeans/RequestInfo.java | 286 ++++ .../vnfbeans/RequestStatusType.java | 71 + .../vnfbeans/VfModuleModelName.java | 261 +++ .../vnfbeans/VfModuleModelNames.java | 104 ++ .../so/apihandlerinfra/vnfbeans/VnfInputs.java | 689 ++++++++ .../so/apihandlerinfra/vnfbeans/VnfOutputs.java | 291 ++++ .../so/apihandlerinfra/vnfbeans/VnfRequest.java | 179 +++ .../so/apihandlerinfra/vnfbeans/VnfRequests.java | 103 ++ .../onap/so/apihandlerinfra/vnfbeans/VnfType.java | 148 ++ .../onap/so/apihandlerinfra/vnfbeans/VnfTypes.java | 104 ++ .../so/apihandlerinfra/vnfbeans/package-info.java | 30 + .../org/openecomp/mso/apihandlerinfra/Action.java | 42 - .../openecomp/mso/apihandlerinfra/Constants.java | 48 - .../mso/apihandlerinfra/E2EServiceInstances.java | 1189 -------------- .../apihandlerinfra/GlobalHealthcheckHandler.java | 66 - .../mso/apihandlerinfra/HealthcheckHandler.java | 66 - .../openecomp/mso/apihandlerinfra/InfraUtils.java | 43 - .../openecomp/mso/apihandlerinfra/ManualTasks.java | 227 --- .../openecomp/mso/apihandlerinfra/Messages.java | 56 - .../openecomp/mso/apihandlerinfra/ModelType.java | 32 - .../mso/apihandlerinfra/MsoException.java | 26 - .../mso/apihandlerinfra/MsoPropertiesUtils.java | 57 - .../openecomp/mso/apihandlerinfra/MsoRequest.java | 1186 -------------- .../apihandlerinfra/NodeHealthcheckHandler.java | 64 - .../mso/apihandlerinfra/OrchestrationRequests.java | 376 ----- .../mso/apihandlerinfra/RecipeLookupResult.java | 76 - .../mso/apihandlerinfra/RequestActionMap.java | 53 - .../mso/apihandlerinfra/ServiceInstances.java | 1249 --------------- .../org/openecomp/mso/apihandlerinfra/Status.java | 34 - .../mso/apihandlerinfra/TasksHandler.java | 327 ---- .../CompareModelsRequest.java | 68 - .../e2eserviceinstancebeans/DelE2ESvcResp.java | 37 - .../e2eserviceinstancebeans/E2EParameters.java | 83 - .../e2eserviceinstancebeans/E2ERequest.java | 113 -- .../e2eserviceinstancebeans/E2EService.java | 120 -- .../E2EServiceInstanceDeleteRequest.java | 46 - .../E2EServiceInstanceRequest.java | 61 - .../E2EServiceInstanceScaleRequest.java | 35 - .../e2eserviceinstancebeans/E2EUserParam.java | 69 - .../GetE2EServiceInstanceResponse.java | 48 - .../LocationConstraint.java | 76 - .../e2eserviceinstancebeans/NsParameters.java | 68 - .../e2eserviceinstancebeans/ResourceRequest.java | 102 -- .../ScaleNsByStepsData.java | 54 - .../e2eserviceinstancebeans/ScaleNsData.java | 34 - .../e2eserviceinstancebeans/ScaleResource.java | 54 - .../e2eserviceinstancebeans/ScaleService.java | 66 - .../e2eserviceinstancebeans/VimLocation.java | 45 - .../mso/apihandlerinfra/package-info.java | 30 - .../apihandlerinfra/tasksbeans/RequestDetails.java | 55 - .../apihandlerinfra/tasksbeans/RequestInfo.java | 73 - .../mso/apihandlerinfra/tasksbeans/TaskList.java | 333 ---- .../tasksbeans/TaskRequestReference.java | 56 - .../tasksbeans/TaskVariableValue.java | 107 -- .../apihandlerinfra/tasksbeans/TaskVariables.java | 39 - .../tasksbeans/TasksGetResponse.java | 36 - .../apihandlerinfra/tasksbeans/TasksRequest.java | 34 - .../apihandlerinfra/tasksbeans/ValidResponses.java | 51 - .../mso/apihandlerinfra/tasksbeans/Value.java | 55 - .../mso/apihandlerinfra/tasksbeans/Variables.java | 74 - .../tenantisolation/AaiClientPropertiesImpl.java | 62 - .../tenantisolation/CloudOrchestration.java | 334 ---- .../tenantisolation/CloudOrchestrationRequest.java | 81 - .../CloudResourcesOrchestration.java | 335 ---- .../tenantisolation/GrmClientPropertiesImpl.java | 70 - .../tenantisolation/ModelDistributionRequest.java | 160 -- .../OperationalEnvironmentProcessFactory.java | 54 - .../tenantisolation/TenantIsolationRequest.java | 476 ------ .../tenantisolation/TenantIsolationRunnable.java | 106 -- .../dmaap/CreateEcompOperationEnvironmentBean.java | 172 -- .../dmaap/DmaapOperationalEnvClient.java | 67 - .../tenantisolation/dmaap/DmaapPropertiesImpl.java | 45 - .../dmaap/OperationalEnvironmentPublisher.java | 58 - .../exceptions/AAIClientCallFailed.java | 29 - .../exceptions/AsdcClientCallFailed.java | 34 - .../exceptions/TenantIsolationException.java | 36 - .../tenantisolation/helpers/AAIClientHelper.java | 145 -- .../helpers/AAIClientObjectBuilder.java | 78 - .../tenantisolation/helpers/AsdcClientHelper.java | 216 --- .../process/ActivateVnfOperationalEnvironment.java | 286 ---- .../ActivateVnfStatusOperationalEnvironment.java | 342 ---- .../process/CreateEcompOperationalEnvironment.java | 82 - .../process/CreateVnfOperationalEnvironment.java | 216 --- .../DeactivateVnfOperationalEnvironment.java | 92 -- .../process/OperationalEnvironmentProcess.java | 78 - .../tenantisolationbeans/Action.java | 28 - .../CloudOrchestrationRequestList.java | 37 - .../CloudOrchestrationResponse.java | 38 - .../tenantisolationbeans/Distribution.java | 44 - .../tenantisolationbeans/DistributionStatus.java | 26 - .../tenantisolationbeans/InstanceReferences.java | 60 - .../tenantisolationbeans/Manifest.java | 53 - .../OperationalEnvironment.java | 27 - .../tenantisolationbeans/RecoveryAction.java | 28 - .../tenantisolationbeans/RelatedInstance.java | 68 - .../tenantisolationbeans/RelatedInstanceList.java | 45 - .../tenantisolationbeans/Request.java | 90 -- .../tenantisolationbeans/RequestDetails.java | 104 -- .../tenantisolationbeans/RequestInfo.java | 118 -- .../tenantisolationbeans/RequestList.java | 96 -- .../tenantisolationbeans/RequestParameters.java | 84 - .../tenantisolationbeans/RequestReferences.java | 96 -- .../tenantisolationbeans/RequestStatus.java | 69 - .../tenantisolationbeans/ResourceType.java | 26 - .../tenantisolationbeans/ServiceModelList.java | 59 - .../tenantisolationbeans/Status.java | 26 - .../TenantIsolationRequest.java | 95 -- .../TenantIsolationResponse.java | 115 -- .../tenantisolationbeans/TenantSyncResponse.java | 35 - .../tenantisolationbeans/package-info.java | 29 - .../mso/apihandlerinfra/vnfbeans/ActionType.java | 80 - .../mso/apihandlerinfra/vnfbeans/ModelType.java | 32 - .../apihandlerinfra/vnfbeans/ObjectFactory.java | 150 -- .../mso/apihandlerinfra/vnfbeans/RequestInfo.java | 286 ---- .../vnfbeans/RequestStatusType.java | 71 - .../vnfbeans/VfModuleModelName.java | 261 --- .../vnfbeans/VfModuleModelNames.java | 103 -- .../mso/apihandlerinfra/vnfbeans/VnfInputs.java | 689 -------- .../mso/apihandlerinfra/vnfbeans/VnfOutputs.java | 291 ---- .../mso/apihandlerinfra/vnfbeans/VnfRequest.java | 179 --- .../mso/apihandlerinfra/vnfbeans/VnfRequests.java | 103 -- .../mso/apihandlerinfra/vnfbeans/VnfType.java | 148 -- .../mso/apihandlerinfra/vnfbeans/VnfTypes.java | 103 -- .../mso/apihandlerinfra/vnfbeans/package-info.java | 30 - .../src/main/java/resources/ManualTasks.xsd | 48 - .../src/main/java/resources/application.properties | 27 - .../services/org.onap.so.client.RestProperties | 1 + .../org.onap.so.client.dmaap.DmaapProperties | 1 + .../services/org.onap.so.client.grm.GRMProperties | 1 + .../org.openecomp.mso.client.RestProperties | 1 - .../org.openecomp.mso.client.dmaap.DmaapProperties | 1 - .../org.openecomp.mso.client.grm.GRMProperties | 1 - .../src/main/resources/application-local.yaml | 160 ++ .../src/main/resources/application.yaml | 70 + .../src/main/resources/static/index.html | 41 + .../src/main/resources/static/readme/index.html | 53 + .../src/main/resources/static/readme/install.html | 34 + .../src/main/resources/static/readme/jars.html | 34 + .../src/main/resources/static/readme/layout.html | 34 + .../src/main/resources/static/readme/logging.html | 34 + .../src/main/resources/static/readme/onaplogo.png | Bin 0 -> 21360 bytes .../main/resources/static/readme/packaging.html | 34 + .../src/main/resources/static/readme/page.html | 70 + .../src/main/resources/static/readme/readme.css | 114 ++ .../src/main/resources/static/readme/spring.html | 34 + .../src/main/resources/static/readme/testing.html | 42 + .../src/main/resources/static/readme/tools.html | 34 + .../resources/static/swagger/favicon-16x16.png | Bin 0 -> 445 bytes .../resources/static/swagger/favicon-32x32.png | Bin 0 -> 1141 bytes .../src/main/resources/static/swagger/index.html | 95 ++ .../resources/static/swagger/oauth2-redirect.html | 60 + .../resources/static/swagger/swagger-ui-bundle.js | 99 ++ .../static/swagger/swagger-ui-standalone-preset.js | 13 + .../main/resources/static/swagger/swagger-ui.css | 2 + .../resources/static/swagger/swagger-ui.css.map | 1 + .../main/resources/static/swagger/swagger-ui.js | 8 + .../test/resources/adv-feature-request.xml | 43 - .../test/resources/adv-service-request.xml | 132 -- .../resources/test/resources/feature-request.xml | 43 - .../resources/test/resources/service-request.xml | 38 - .../src/main/resources/xsd/ManualTasks.xsd | 48 - .../so/apihandler/common/ResponseBuilderTest.java | 73 + .../apihandler/filters/RequestUriFilterTest.java | 57 + .../recipe/CamundaClientErrorHandlerTest.java | 72 + .../onap/so/apihandlerinfra/AllTestsTestSuite.java | 32 + .../so/apihandlerinfra/ApiExceptionMapperTest.java | 102 ++ .../onap/so/apihandlerinfra/ApiExceptionTest.java | 128 ++ .../java/org/onap/so/apihandlerinfra/BaseTest.java | 90 ++ .../org/onap/so/apihandlerinfra/BeanMultiTest.java | 67 + .../apihandlerinfra/E2EServiceInstancesTest.java | 229 +++ .../apihandlerinfra/EmbeddedCatalogDbConfig.java | 102 ++ .../apihandlerinfra/EmbeddedRequestDbConfig.java | 102 ++ .../so/apihandlerinfra/HealthCheckHandlerTest.java | 55 + .../onap/so/apihandlerinfra/ManualTasksTest.java | 118 ++ .../onap/so/apihandlerinfra/MsoRequestTest.java | 467 ++++++ .../apihandlerinfra/OrchestrationRequestsTest.java | 389 +++++ .../so/apihandlerinfra/RequestActionMapTest.java | 36 + .../apihandlerinfra/ServiceInstanceBeansTest.java | 50 + .../so/apihandlerinfra/ServiceInstancesTest.java | 1407 +++++++++++++++++ .../onap/so/apihandlerinfra/TasksHandlerTest.java | 123 ++ .../org/onap/so/apihandlerinfra/TestAppender.java | 37 + .../e2eserviceinstancebeans/DelE2ESvcRespTest.java | 38 + .../e2eserviceinstancebeans/E2ERequestTest.java | 54 + .../E2EServiceInstanceDeleteRequestTest.java | 41 + .../e2eserviceinstancebeans/E2EUserParamTest.java | 48 + .../e2eserviceinstancebeans/NsParametersTest.java | 52 + .../tasksbeans/RequestDetailsTest.java | 71 + .../tasksbeans/RequestInfoTest.java | 118 ++ .../apihandlerinfra/tasksbeans/TaskListTest.java | 247 +++ .../tasksbeans/TaskRequestReferenceTest.java | 71 + .../tasksbeans/TaskVariableValueTest.java | 113 ++ .../tasksbeans/TaskVariablesTest.java | 69 + .../tasksbeans/TasksGetResponseTest.java | 69 + .../tasksbeans/TasksRequestTest.java | 70 + .../so/apihandlerinfra/tasksbeans/ValueTest.java | 68 + .../apihandlerinfra/tasksbeans/VariablesTest.java | 95 ++ .../tenantisolation/CloudOrchestrationTest.java | 289 ++++ .../CloudResourcesOrchestrationTest.java | 401 +++++ .../ModelDistributionRequestTest.java | 114 ++ .../TenantIsolationRequestTest.java | 143 ++ .../dmaap/DmaapOperationalEnvClientTest.java | 72 + .../dmaap/OperationalEnvironmentPublisherTest.java | 51 + .../tenantisolation/dmaap/SDCDmaapClientTest.java | 70 + .../exceptions/SDCClientCallFailedTest.java | 45 + .../exceptions/TenantIsolationExceptionTest.java | 45 + .../helpers/AAIClientHelperTest.java | 147 ++ .../helpers/AAIClientObjectBuilderTest.java | 69 + .../helpers/ActivateVnfDBHelperTest.java | 142 ++ .../helpers/SDCClientHelperTest.java | 194 +++ .../ActivateVnfOperationalEnvironmentTest.java | 238 +++ ...ctivateVnfStatusOperationalEnvironmentTest.java | 640 ++++++++ .../CreateEcompOperationalEnvironmentTest.java | 130 ++ .../CreateVnfOperationalEnvironmentTest.java | 146 ++ .../DeactivateVnfOperationalEnvironmentTest.java | 160 ++ .../TenantIsolationBeansTest.java | 87 + .../validation/RelatedInstancesValidationTest.java | 55 + .../openecomp/mso/apihandlerinfra/BeanTest.java | 59 - .../openecomp/mso/apihandlerinfra/BeansTest.java | 76 - .../apihandlerinfra/E2EServiceInstancesTest.java | 1327 ---------------- .../GlobalHealthcheckHandlerTest.java | 60 - .../mso/apihandlerinfra/ManualTasksTest.java | 38 - .../mso/apihandlerinfra/MsoRequestTest.java | 624 -------- .../NodeHealthcheckHandlerTest.java | 35 - .../apihandlerinfra/OrchestrationRequestsTest.java | 248 --- .../apihandlerinfra/RecipeLookupResultTest.java | 96 -- .../mso/apihandlerinfra/RequestActionMapTest.java | 36 - .../mso/apihandlerinfra/ServiceInstanceTest.java | 1168 -------------- .../mso/apihandlerinfra/ServiceInstancesTest.java | 134 -- .../mso/apihandlerinfra/TasksHandlerTest.java | 41 - .../e2eserviceinstancebeans/DelE2ESvcRespTest.java | 38 - .../e2eserviceinstancebeans/E2ERequestTest.java | 54 - .../E2EServiceInstanceDeleteRequestTest.java | 41 - .../e2eserviceinstancebeans/E2EUserParamTest.java | 48 - .../e2eserviceinstancebeans/NsParametersTest.java | 52 - .../taskbeans/RequestDetailsTest.java | 74 - .../apihandlerinfra/taskbeans/RequestInfoTest.java | 120 -- .../apihandlerinfra/taskbeans/TaskListTest.java | 247 --- .../taskbeans/TaskRequestReferenceTest.java | 72 - .../taskbeans/TaskVariableValueTest.java | 114 -- .../taskbeans/TaskVariablesTest.java | 71 - .../taskbeans/TasksGetResponseTest.java | 71 - .../taskbeans/TasksRequestTest.java | 72 - .../mso/apihandlerinfra/taskbeans/ValueTest.java | 69 - .../apihandlerinfra/taskbeans/VariablesTest.java | 97 -- .../tasksbeans/RequestDetailsTest.java | 71 - .../tasksbeans/RequestInfoTest.java | 118 -- .../apihandlerinfra/tasksbeans/TaskListTest.java | 246 --- .../tasksbeans/TaskRequestReferenceTest.java | 71 - .../tasksbeans/TaskVariableValueTest.java | 113 -- .../tasksbeans/TaskVariablesTest.java | 69 - .../tasksbeans/TasksGetResponseTest.java | 69 - .../tasksbeans/TasksRequestTest.java | 70 - .../mso/apihandlerinfra/tasksbeans/ValueTest.java | 68 - .../apihandlerinfra/tasksbeans/VariablesTest.java | 95 -- .../tenantisolation/CloudOrchestrationTest.java | 209 --- .../CloudResourcesOrchestrationTest.java | 333 ---- .../ModelDistributionRequestTest.java | 93 -- .../TenantIsolationRequestTest.java | 130 -- .../tenantisolation/dmaap/AsdcDmaapClientTest.java | 69 - .../dmaap/DmaapOperationalEnvClientTest.java | 68 - .../dmaap/OperationalEnvironmentPublisherTest.java | 55 - .../helpers/AAIClientHelperTest.java | 94 -- .../helpers/AAIClientObjectBuilderTest.java | 68 - .../helpers/AsdcClientHelperTest.java | 209 --- .../tenantisolation/mock/AaiStubResponse.java | 57 - .../tenantisolation/mock/MockTest.java | 64 - .../ActivateVnfOperationalEnvironmentTest.java | 249 --- ...ctivateVnfStatusOperationalEnvironmentTest.java | 670 -------- .../CreateEcompOperationalEnvironmentTest.java | 90 -- .../CreateVnfOperationalEnvironmentTest.java | 106 -- .../DeactivateVnfOperationalEnvironmentTest.java | 91 -- .../CloudOrchestrationTest.java | 113 -- .../TenantIsolationBeansTest.java | 61 - .../resources/ActivateOperationEnvironment.json | 33 - .../ActivateOperationEnvironmentInvalid.json | 23 - .../src/test/resources/ApplyUpdatedConfig.json | 11 - .../src/test/resources/CloudConfiguration.json | 39 - .../resources/ConfigurationModelVersionId.json | 43 - .../resources/DeactivateOperationEnvironment.json | 12 - .../DeactivateOperationEnvironmentInvalid.json | 12 - .../CompareModelRequest.json | 6 + .../E2EServiceInstancesTest/DeleteRequest.json | 4 + .../resources/E2EServiceInstancesTest/Request.json | 81 + .../E2EServiceInstancesTest/ScaleRequest.json | 18 + .../resources/ECOMPOperationEnvironmentCreate.json | 15 - .../test/resources/EmptyCloudConfiguration.json | 37 - .../test/resources/EmptyGlobalSubscriberId.json | 42 - .../src/test/resources/EmptyInstanceName.json | 43 - .../test/resources/EmptyLcpCloudConfiguration.json | 41 - .../src/test/resources/EmptyLineOfBusiness.json | 46 - .../src/test/resources/EmptyOwningEntityId.json | 41 - .../src/test/resources/EmptyOwningEntityName.json | 42 - .../src/test/resources/EmptyPlatform.json | 46 - .../src/test/resources/EmptyProject.json | 43 - .../src/test/resources/EmptyRequestorId.json | 41 - .../src/test/resources/EmptySource.json | 35 - .../src/test/resources/EmptySubscriberInfo.json | 32 - .../resources/EmptySubscriptionServiceType.json | 41 - .../src/test/resources/EmptyTenantId.json | 41 - .../src/test/resources/InPlaceSoftwareUpdate.json | 15 - .../InPlaceSoftwareUpdateCloudConfiguration.json | 38 - .../InPlaceSoftwareUpdateCloudRegionId.json | 41 - .../resources/InPlaceSoftwareUpdateTenantId.json | 41 - .../test/resources/InfraActiveRequestsReset.sql | 15 + .../src/test/resources/InvalidInstanceName.json | 44 - .../test/resources/InvalidModelInvariantId.json | 43 - .../src/test/resources/LineOfBusiness.json | 43 - .../src/test/resources/ModelCustomizationId.json | 37 - .../resources/ModelCustomizationIdPreload.json | 38 - .../ModelCustomizationIdUsingPreload.json | 44 - .../src/test/resources/ModelInfoNull.json | 37 - .../src/test/resources/ModelInvariantId.json | 41 - .../resources/ModelInvariantIdConfiguration.json | 41 - .../ModelInvariantIdConfigurationDelete.json | 41 - .../src/test/resources/ModelInvariantIdFormat.json | 43 - .../test/resources/ModelInvariantIdService.json | 41 - .../resources/ModelInvariantIdServiceCreate.json | 42 - .../src/test/resources/ModelInvariantIdVnf.json | 41 - .../src/test/resources/ModelNameVersionId.json | 37 - .../src/test/resources/ModelTypeNull.json | 42 - .../src/test/resources/ModelVersion.json | 43 - .../src/test/resources/ModelVersionId.json | 43 - .../src/test/resources/ModelVersionIdCreate.json | 43 - .../src/test/resources/ModelVersionIdTest.json | 43 - .../src/test/resources/ModelVersionNetwork.json | 42 - .../src/test/resources/ModelVersionService.json | 42 - .../src/test/resources/ModelVersionVfModule.json | 42 - .../CloudConfiguration/CloudConfiguration.json | 39 + .../CloudConfigurationConfig.json | 40 + .../CloudConfigurationNetwork.json | 40 + .../CloudConfiguration/CloudConfigurationVnf.json | 40 + ...DeactivateAndCloudDeleteCloudConfiguration.json | 11 + .../EmptyCloudConfiguration.json | 37 + .../EmptyLcpCloudConfiguration.json | 42 + .../CloudConfiguration/EmptyTenantId.json | 42 + .../InPlaceSoftwareUpdateCloudConfiguration.json | 38 + .../InPlaceSoftwareUpdateCloudRegionId.json | 41 + .../InPlaceSoftwareUpdateTenantId.json | 41 + .../ModelInfo/ConfigurationModelVersionId.json | 43 + .../ModelInfo/InvalidModelInvariantId.json | 44 + .../ModelInfo/ModelCustomization.json | 40 + .../ModelInfo/ModelCustomizationId.json | 37 + .../ModelCustomizationIdUsingPreload.json | 44 + .../ModelInfo/ModelCustomizationName.json | 43 + .../MsoRequestTest/ModelInfo/ModelInfoNull.json | 37 + .../MsoRequestTest/ModelInfo/ModelInvariantId.json | 41 + .../ModelInfo/ModelInvariantIdConfiguration.json | 41 + .../ModelInvariantIdConfigurationDelete.json | 41 + .../ModelInfo/ModelInvariantIdService.json | 41 + .../ModelInfo/ModelInvariantIdVnf.json | 41 + .../ModelInfo/ModelNameVersionId.json | 37 + .../MsoRequestTest/ModelInfo/ModelTypeNull.json | 42 + .../MsoRequestTest/ModelInfo/ModelVersionId.json | 43 + .../ModelInfo/ModelVersionIdCreate.json | 43 + .../ModelInfo/ModelVersionNetwork.json | 42 + .../ModelInfo/ModelVersionService.json | 42 + .../ModelInfo/ModelVersionServiceCreate.json | 42 + .../ModelInfo/ModelVersionVfModule.json | 42 + .../ModelInfo/ServiceModelNameEmptyOnActivate.json | 38 + .../ModelInfo/ServiceModelNameEmptyOnDelete.json | 38 + .../ModelInfo/ValidModelCustomizationId.json | 66 + .../ValidModelCustomizationIdService.json | 66 + .../ModelInfo/VfModuleModelName.json | 38 + .../ModelInfo/VnfModelCustomizationId.json | 37 + .../ModelInfo/VnfModelCustomizationIdEmpty.json | 65 + .../ModelInfo/VnfModelCustomizationIdPreload.json | 36 + .../ModelInfo/VnfModelCustomizationNameNull.json | 38 + .../ModelInfo/VnfModelCustomizationTest.json | 39 + .../MsoRequestTest/ModelInfo/v2ModelVersionId.json | 43 + .../ModelInfo/v3UpdateNetworkBad.json | 38 + ...4CreateVfModuleMissingModelCustomizationId.json | 61 + .../v4CreateVfModuleNoCustomizationId.json | 61 + .../ModelInfo/v5ActivateModelVersionId.json | 34 + .../v5CreateConfigurationModelCustomizationId.json | 64 + .../ModelInfo/v5DeactivateModelInvariantId.json | 34 + .../ModelInfo/v5ModelInvariantIdDisablePort.json | 41 + .../ModelInfo/v5ModelInvariantIdNetwork.json | 41 + .../EmptyLineOfBusiness.json | 46 + .../EmptyPlatformName.json | 46 + .../OptionalLineOfBusiness.json | 43 + .../PlatformAndLineOfBusiness/Platform.json | 43 + .../PlatformAndLineOfBusiness.json | 46 + .../PlatformAndLineOfBusiness/PlatformTest.json | 44 + .../EmptyOwningEntityId.json | 41 + .../EmptyOwningEntityName.json | 42 + .../ProjectAndOwningEntity/EmptyProjectName.json | 43 + .../ProjectAndOwningEntity/OptionalProject.json | 40 + .../ProjectAndOwningEntity/OwningEntity.json | 39 + .../ProjectAndOwningEntity.json | 43 + .../ProjectAndOwningEntity/ServiceAssignNoOE.json | 115 ++ .../RelatedInstances/InvalidInstanceName.json | 44 + .../RelatedInstances/RelatedInstances.json | 33 + .../RelatedInstances/RelatedInstancesId.json | 46 + .../RelatedInstances/RelatedInstancesIdFormat.json | 46 + .../RelatedInstancesInstanceId.json | 47 + .../RelatedInstancesModelCustomizationId.json | 48 + .../RelatedInstancesModelInfo.json | 39 + .../RelatedInstancesModelInvariantId.json | 46 + .../RelatedInstancesModelInvariantIdFormat.json | 46 + .../RelatedInstancesModelName.json | 46 + .../RelatedInstancesModelType.json | 45 + .../RelatedInstancesModelVersion.json | 46 + .../RelatedInstancesModelVersionId.json | 46 + .../RelatedInstancesNameFormat.json | 47 + .../RelatedInstancesServiceInstance.json | 48 + .../RelatedInstances/RelatedInstancesVfModule.json | 33 + .../RelatedInstancesVnfInstance.json | 48 + .../RelatedInstancesVnfInstanceId.json | 48 + .../RelatedInstances/ServiceNoRelatedInstance.json | 23 + .../VfModuleRelatedInstancesService.json | 48 + .../VfModuleRelatedInstancesVnf.json | 48 + .../VnfRelatedInstancesService.json | 48 + .../VolumeGroupRelatedInstances.json | 61 + .../RelatedInstances/v4RelatedInstancesNull.json | 27 + .../v5ActivateNoRelatedInstance.json | 20 + .../v5CreateNoDestinationRelatedInstance.json | 51 + .../v5CreateNoRelatedInstances.json | 23 + .../v5CreateNoSourceRelatedInstance.json | 51 + .../v5DeactivateNoRelatedInstance.json | 20 + .../v5EnablePortNoConnectionPoint.json | 31 + .../v5EnablePortNoRelatedInstance.json | 17 + .../v6AddRelationshipsInstanceName.json | 51 + .../RelatedInstances/v6VnfDeleteInstance.json | 42 + .../v7CreateVnfNetworkCollection.json | 56 + .../RequestInfo/EmptyRequestorId.json | 41 + .../MsoRequestTest/RequestInfo/EmptySource.json | 35 + .../RequestInfo/NetworkProductFamilyId.json | 44 + .../MsoRequestTest/RequestInfo/RequestInfo.json | 35 + .../RequestInfo/RequestInfoNull.json | 37 + .../MsoRequestTest/RequestInfo/RequestorId.json | 41 + .../RequestInfo/ServiceProductFamilyId.json | 44 + .../RequestInfo/ServiceProductFamilyIdFlag.json | 72 + .../RequestInfo/ServiceProductFamilyIdUpdate.json | 44 + .../RequestInfo/VnfProductFamilyId.json | 44 + .../RequestParameters/AssignCloudConfigVnf.json | 126 ++ .../AssignEmptyReqParameters.json | 31 + .../MsoRequestTest/RequestParameters/Network.json | 133 ++ .../RequestParameters/NetworkCloudConfig.json | 138 ++ .../NetworkModelCustomizationId.json | 137 ++ .../RequestParameters/NetworkModelVersionId.json | 137 ++ .../RequestParameters/ProductFamilyId.json | 129 ++ .../RequestParameters/RequestParameters.json | 38 + .../RequestParametersALaCarteTrue.json | 37 + .../RequestParameters/RequestParametersNull.json | 21 + .../UserParamsModelCustomizationId.json | 129 ++ .../RequestParameters/UserParamsModelInfo.json | 120 ++ .../UserParamsModelVersionId.json | 129 ++ .../RequestParameters/UserParamsPlatform.json | 127 ++ .../RequestParameters/UserParamsPlatformName.json | 129 ++ .../RequestParameters/UserParamsVnfModelInfo.json | 116 ++ .../VfModuleModelCustomizationId.json | 129 ++ .../RequestParameters/VfModuleModelVersionId.json | 129 ++ .../RequestParameters/VfModules.json | 75 + .../RequestParameters/VfModulesModelInfo.json | 125 ++ .../RequestParameters/VnfModelCustomizationId.json | 129 ++ .../RequestParameters/VnfModelVersionId.json | 128 ++ .../RequestParameters/VnfRequestParameters.json | 40 + .../v2requestParametersALaCarteFalse.json | 44 + .../v3DeleteServiceInstanceALaCarte.json | 22 + .../SubscriberInfo/AssignEmptySubscriberInfo.json | 116 ++ .../SubscriberInfo/EmptyGlobalSubscriberId.json | 42 + .../SubscriberInfo/EmptySubscriberInfo.json | 32 + .../EmptySubscriptionServiceType.json | 42 + .../SuccessfulValidation/InstanceIdHashMap.json | 40 + .../SuccessfulValidation/NetworkType.json | 43 + .../SuccessfulValidation/ServiceAssign.json | 130 ++ .../ServiceInPlaceSoftwareUpdate.json | 42 + .../SuccessfulValidation/ServiceUnassign.json | 20 + .../SuccessfulValidation/UserParams.json | 59 + .../SuccessfulValidation/VfModulesModelInfo.json | 120 ++ .../SuccessfulValidation/VnfActivate.json | 41 + .../SuccessfulValidation/v3DeleteNetwork.json | 15 + .../v3DeleteServiceInstance.json | 27 + .../v3DeleteServiceInstanceALaCarte.json | 22 + .../SuccessfulValidation/v3UpdateNetwork.json | 39 + .../SuccessfulValidation/v3VnfCreate.json | 41 + .../SuccessfulValidation/v4CreateVfModule.json | 62 + .../v5ActivateConfiguration.json | 35 + .../v5CreateConfiguration.json | 65 + .../v5DeactivateConfiguration.json | 35 + .../v5EnableConfiguration.json | 40 + .../SuccessfulValidation/v5EnableService.json | 41 + .../SuccessfulValidation/v6AddRelationships.json | 52 + .../v6CreateConfiguration.json | 66 + .../src/test/resources/NetworkModelName.json | 43 - .../src/test/resources/NetworkProductFamilyId.json | 44 - .../src/test/resources/NetworkType.json | 43 - .../OrchestrationRequest/AlaCarteRequest.json | 36 + .../OrchestrationRequest/OrchestrationList.json | 1 + .../resources/OrchestrationRequest/Request.json | 8 + .../SampleGetResponse.json | 22 + .../src/test/resources/OwningEntity.json | 39 - .../src/test/resources/Payload.json | 41 - .../src/test/resources/Platform.json | 43 - .../test/resources/PlatformAndLineOfBusiness.json | 46 - .../test/resources/PlatformAndLineOfBusiness2.json | 43 - .../PlatformAndLineOfBusinessInvalid.json | 43 - .../PlatformAndLineOfBusinessInvalid2.json | 43 - .../src/test/resources/PlatformTest.json | 44 - .../src/test/resources/Project.json | 40 - .../src/test/resources/ProjectAndOwningEntity.json | 43 - .../test/resources/ProjectAndOwningEntity2.json | 40 - .../resources/ProjectAndOwningEntityInvalid.json | 39 - .../resources/ProjectAndOwningEntityInvalid2.json | 40 - .../src/test/resources/RelatedInstances.json | 33 - .../src/test/resources/RelatedInstancesId.json | 46 - .../test/resources/RelatedInstancesIdFormat.json | 46 - .../RelatedInstancesInstanceDirection.json | 46 - .../test/resources/RelatedInstancesInstanceId.json | 47 - .../RelatedInstancesModelCustomizationId.json | 48 - .../test/resources/RelatedInstancesModelInfo.json | 39 - .../RelatedInstancesModelInvariantId.json | 46 - .../RelatedInstancesModelInvariantIdFormat.json | 46 - .../test/resources/RelatedInstancesModelName.json | 46 - .../test/resources/RelatedInstancesModelType.json | 45 - .../resources/RelatedInstancesModelVersion.json | 46 - .../resources/RelatedInstancesModelVersionId.json | 46 - .../test/resources/RelatedInstancesNameFormat.json | 47 - .../resources/RelatedInstancesServiceInstance.json | 48 - .../RelatedInstancesServiceInstanceId.json | 48 - .../resources/RelatedInstancesSetInstances.json | 48 - .../test/resources/RelatedInstancesVfModule.json | 33 - .../resources/RelatedInstancesVnfInstance.json | 48 - .../resources/RelatedInstancesVnfInstanceId.json | 48 - .../src/test/resources/RequestInfo.json | 35 - .../src/test/resources/RequestInfoNull.json | 37 - .../src/test/resources/RequestParameters.json | 38 - .../resources/RequestParametersALaCarteNull.json | 36 - .../resources/RequestParametersALaCarteTrue.json | 37 - .../src/test/resources/RequestParametersNull.json | 21 - .../src/test/resources/RequestorId.json | 41 - .../resources/ServiceInPlaceSoftwareUpdate.json | 42 - .../ServiceInstanceTest/AddRelationships.json | 66 + .../ServiceInstanceTest/ApplyUpdatedConfig.json | 12 + .../ServiceInstanceTest/ConvertRequestFail.json | 48 + .../DeactivateAndCloudDeleteVfModule.json | 18 + .../ServiceInstanceTest/DeleteVfModule.json | 32 + .../resources/ServiceInstanceTest/DeleteVnf.json | 62 + .../resources/ServiceInstanceTest/DeleteVnfV5.json | 22 + .../ServiceInstanceTest/DeleteVolumeGroup.json | 60 + .../ServiceInstanceTest/InPlaceSoftwareUpdate.json | 16 + .../InPlaceSoftwareUpdate2.json | 16 + .../LegacyMacroServiceInstance.json | 74 + .../ServiceInstanceTest/MacroServiceInstance.json | 129 ++ .../ServiceInstanceTest/NetworkCreate.json | 45 + .../NetworkCreateAlternateInstanceName.json | 45 + .../NetworkCreateTestApiGrApi.json | 46 + .../NetworkCreateTestApiIncorrect.json | 46 + .../NetworkCreateTestApiVnfApi.json | 46 + .../ServiceInstanceTest/NetworkInstance.json | 45 + .../NetworkInstanceNoReqParams.json | 15 + .../ServiceInstanceTest/NoVnfResource.json | 49 + .../ServiceInstanceTest/RemoveRelationships.json | 66 + .../ServiceInstanceTest/ReplaceVfModule.json | 32 + .../resources/ServiceInstanceTest/ReplaceVnf.json | 62 + .../ServiceInstanceTest/ReplaceVnfRecreate.json | 62 + .../ServiceInstanceTest/ServiceAssign.json | 134 ++ .../ServiceInstanceTest/ServiceInstance.json | 66 + .../ServiceInstanceALaCarteTrue.json | 31 + .../ServiceInstanceALaCarteTrueNoRecipe.json | 32 + .../ServiceInstanceActivate.json | 66 + .../ServiceInstanceActivatePort.json | 66 + .../ServiceInstanceBadGateway.json | 31 + .../ServiceInstanceDeactivate.json | 66 + .../ServiceInstanceDeactivatePort.json | 66 + .../ServiceInstanceDefault.json | 32 + .../ServiceInstanceTest/ServiceInstanceDelete.json | 66 + .../ServiceInstanceDisablePort.json | 70 + .../ServiceInstanceDuplicates.json | 31 + .../ServiceInstanceTest/ServiceInstanceEmpty.json | 31 + .../ServiceInstanceEnablePort.json | 66 + .../ServiceInstanceTest/ServiceInstanceMacro.json | 34 + .../ServiceInstanceNoRecipe.json | 31 + .../ServiceInstanceParseFail.json | 65 + .../ServiceInstancePortConfiguration.json | 65 + .../ServiceInstanceTest/ServiceInstancePrev7.json | 32 + .../ServiceInstanceTest/ServiceInstancePrev8.json | 32 + .../ServiceInstanceStatusError.json | 31 + .../ServiceRequestExpected.json | 72 + .../ServiceInstanceTest/ServiceUnassign.json | 21 + .../ServiceInstanceTest/UpdateNetwork.json | 45 + .../ServiceInstanceTest/UpdateVfModule.json | 60 + .../resources/ServiceInstanceTest/UpdateVnf.json | 62 + .../ServiceInstanceTest/UpdateVolumeGroup.json | 60 + .../ServiceInstanceTest/VfModuleInstance.json | 32 + .../ServiceInstanceTest/VfModuleInvalid.json | 61 + .../VfModuleNoMatchingModelUUID.json | 60 + .../VfModuleNoModelCustomization.json | 61 + .../ServiceInstanceTest/VfModuleNoModelType.json | 20 + .../VfModuleWithRelatedInstances.json | 54 + .../ServiceInstanceTest/VnfCreateDefault.json | 47 + .../VnfWithServiceRelatedInstance.json | 48 + .../VnfWithServiceRelatedInstanceFail.json | 47 + .../VnfWithVnfRelatedInstance.json | 62 + .../resources/ServiceInstanceTest/VolumeGroup.json | 60 + .../resources/ServiceInstanceTest/userParams.txt | 37 + .../resources/ServiceModelNameEmptyOnActivate.json | 38 - .../resources/ServiceModelNameEmptyOnDelete.json | 38 - .../test/resources/ServiceNoRelatedInstance.json | 23 - .../src/test/resources/ServiceProductFamilyId.json | 44 - .../test/resources/ServiceProductFamilyIdFlag.json | 72 - .../resources/ServiceProductFamilyIdUpdate.json | 44 - .../src/test/resources/Source.json | 41 - .../ActivateOperationEnvironment.json | 33 + .../ActivateOperationEnvironmentInvalid.json | 23 + .../DeactivateOperationEnvironment.json | 12 + .../DeactivateOperationEnvironmentInvalid.json | 12 + .../ECOMPOperationEnvironmentCreate.json | 15 + .../VNFOperationEnvironmentCreate.json | 24 + .../VNFOperationEnvironmentCreateInvalid.json | 15 + .../src/test/resources/UserParams.json | 59 - .../resources/VNFOperationEnvironmentCreate.json | 24 - .../VNFOperationEnvironmentCreateInvalid.json | 15 - .../test/resources/ValidModelCustomizationId.json | 66 - .../ValidModelCustomizationIdService.json | 66 - .../src/test/resources/VfModuleModelName.json | 38 - .../src/test/resources/VfModuleModelNameEmpty.json | 38 - .../resources/VfModuleModelNameEmptyOnDelete.json | 38 - .../resources/VfModuleModelNameEmptyOnUpdate.json | 37 - .../resources/VfModuleRelatedInstancesService.json | 48 - .../resources/VfModuleRelatedInstancesVnf.json | 48 - .../src/test/resources/VfModuleVnfInstance.json | 48 - .../src/test/resources/VnfActivate.json | 41 - .../test/resources/VnfModelCustomizationId.json | 37 - .../resources/VnfModelCustomizationIdEmpty.json | 65 - .../resources/VnfModelCustomizationIdPreload.json | 36 - .../resources/VnfModelCustomizationIdValid.json | 65 - .../test/resources/VnfModelCustomizationName.json | 39 - .../resources/VnfModelCustomizationNameNull.json | 38 - .../resources/VnfModelCustomizationNotValid.json | 39 - .../test/resources/VnfModelCustomizationTest.json | 39 - .../src/test/resources/VnfModelName.json | 39 - .../src/test/resources/VnfProductFamilyId.json | 44 - .../VnfRelatedInstancesInstanceDirection.json | 50 - .../test/resources/VnfRelatedInstancesService.json | 48 - .../src/test/resources/VnfRequestParameters.json | 40 - .../resources/VolumeGroupRelatedInstances.json | 61 - .../__files/Camunda/AVPNBPMNErrorResponse.json | 7 + .../__files/Camunda/AVPNBPMNResponse.json | 7 + .../__files/Camunda/AsyncProcessResponse.json | 6 + .../resources/__files/Camunda/BPMNResponse.json | 7 + .../test/resources/__files/Camunda/ErrorBPEL.json | 1 + .../resources/__files/Camunda/GetTaskResponse.json | 48 + .../__files/Camunda/GetTaskVariablesResponse.json | 109 ++ .../__files/Camunda/SuccessfulResponse.json | 4 + .../resources/__files/Camunda/TestResponse.json | 7 + .../__files/Camunda/TestResponseInvalid.json | 7 + .../__files/Camunda/TestResponseInvalid2.json | 7 + .../__files/PlatformAndLineOfBusiness.json | 46 - .../__files/aai/mockGetAAIOperEnvIdResponse.json | 18 +- .../__files/aai/operationalEnvironmentInvalid.json | 16 +- .../createVnfOperationalEnvironmentRequest.json | 2 +- .../resources/__files/vnfoperenv/endpoints.json | 6 +- .../src/test/resources/application-test.yaml | 124 ++ .../src/test/resources/data.sql | 291 ++++ .../src/test/resources/logback-test.xml | 25 +- .../src/test/resources/logging.properties | 2 - .../test/resources/mso.apihandler-infra.properties | 37 - .../asdc/create-ecompoe/ecomp-openv-request.json | 8 + .../asdc/create-ecompoe/ecomp-openv-request.json | 8 - .../src/test/resources/schema.sql | 993 ++++++++++++ .../test/resources/v2AutoBuildVfModulesFalse.json | 43 - .../test/resources/v2AutoBuildVfModulesTrue.json | 43 - .../src/test/resources/v2ModelVersionId.json | 43 - .../v2VfModuleModelNameEmptyOnDelete.json | 38 - .../v2requestParametersALaCarteFalse.json | 44 - .../src/test/resources/v3DeleteNetwork.json | 15 - .../test/resources/v3DeleteServiceInstance.json | 27 - .../resources/v3DeleteServiceInstanceALaCarte.json | 22 - .../test/resources/v3DeleteServiceInstanceBad.json | 26 - .../src/test/resources/v3UpdateNetwork.json | 39 - .../src/test/resources/v3UpdateNetworkBad.json | 38 - .../src/test/resources/v3VnfCreate.json | 41 - .../src/test/resources/v3VolumeGroupBad.json | 27 - .../src/test/resources/v4CreateVfModule.json | 62 - ...4CreateVfModuleMissingModelCustomizationId.json | 61 - .../v4CreateVfModuleNoCustomizationId.json | 61 - .../resources/v5ActivatePortMirrorBadData.json | 34 - .../v5ActivatePortMirrorConfiguration.json | 35 - .../v5ActivatePortMirrorNoRelatedInstance.json | 20 - .../resources/v5DeactivatePortMirrorBadData.json | 34 - .../v5DeactivatePortMirrorConfiguration.json | 35 - .../v5DeactivatePortMirrorNoRelatedInstance.json | 20 - .../resources/v5EnablePortMirrorConfiguration.json | 40 - .../v5EnablePortMirrorNoConnectionPoint.json | 31 - .../v5EnablePortMirrorNoRelatedInstance.json | 17 - .../test/resources/v5EnablePortMirrorService.json | 41 - .../resources/v5ModelInvariantIdDisablePort.json | 41 - .../test/resources/v5ModelInvariantIdNetwork.json | 41 - .../resources/v5PortMirrorCreateConfiguration.json | 65 - .../v5PortMirrorCreateConfigurationBad.json | 64 - ...rtMirrorCreateNoDestinationRelatedInstance.json | 51 - .../v5PortMirrorCreateNoRelatedInstances.json | 23 - .../v5PortMirrorCreateNoSourceRelatedInstance.json | 51 - .../src/test/resources/v6AddRelationships.json | 52 - .../test/resources/v6AddRelationshipsBadData.json | 51 - .../resources/v6PortMirrorCreateConfiguration.json | 66 - .../src/test/resources/v6VnfDeleteInstance.json | 42 - .../mso-requests-db/hibernate.properties | 4 +- .../mso-requests-db/hibernate.reveng.xml | 20 +- mso-api-handlers/mso-requests-db/pom.xml | 206 +-- .../so/db/request/beans/ArchivedInfraRequests.java | 91 ++ .../so/db/request/beans/InfraActiveRequests.java | 93 ++ .../onap/so/db/request/beans/InfraRequests.java | 556 +++++++ .../onap/so/db/request/beans/OperationStatus.java | 239 +++ .../so/db/request/beans/OperationStatusId.java | 79 + .../beans/OperationalEnvDistributionStatus.java | 177 +++ .../beans/OperationalEnvServiceModelStatus.java | 190 +++ .../beans/OperationalEnvServiceModelStatusId.java | 82 + .../db/request/beans/ResourceOperationStatus.java | 223 +++ .../request/beans/ResourceOperationStatusId.java | 91 ++ .../org/onap/so/db/request/beans/SiteStatus.java | 105 ++ .../java/org/onap/so/db/request/beans/Status.java | 40 + .../beans/WatchdogComponentDistributionStatus.java | 140 ++ .../WatchdogComponentDistributionStatusId.java | 73 + .../request/beans/WatchdogDistributionStatus.java | 124 ++ .../beans/WatchdogServiceModVerIdLookup.java | 111 ++ .../beans/WatchdogServiceModVerIdLookupId.java | 74 + .../ArchivedInfraRequestsRepository.java | 30 + .../repository/InfraActiveRequestsRepository.java | 41 + .../InfraActiveRequestsRepositoryCustom.java | 57 + .../InfraActiveRequestsRepositoryImpl.java | 566 +++++++ .../data/repository/OperationStatusRepository.java | 34 + ...OperationalEnvDistributionStatusRepository.java | 42 + ...OperationalEnvServiceModelStatusRepository.java | 59 + .../ResourceOperationStatusRepository.java | 34 + .../data/repository/SiteStatusRepository.java | 31 + ...chdogComponentDistributionStatusRepository.java | 34 + .../WatchdogDistributionStatusRepository.java | 30 + .../WatchdogServiceModVerIdLookupRepository.java | 33 + .../org/onap/so/requestsdb/RequestsDBHelper.java | 107 ++ .../org/onap/so/requestsdb/RequestsDbConstant.java | 66 + .../so/requestsdb/adapter/TimestampXMLAdapter.java | 42 + .../mso/requestsdb/InfraActiveRequests.java | 41 - .../openecomp/mso/requestsdb/InfraRequests.java | 448 ------ .../mso/requestsdb/MockRequestsDatabase.java | 72 - .../openecomp/mso/requestsdb/OperationStatus.java | 228 --- .../OperationalEnvDistributionStatus.java | 106 -- .../OperationalEnvDistributionStatusDb.java | 196 --- .../OperationalEnvServiceModelStatus.java | 121 -- .../OperationalEnvServiceModelStatusDb.java | 243 --- .../openecomp/mso/requestsdb/RequestsDBHelper.java | 71 - .../openecomp/mso/requestsdb/RequestsDatabase.java | 888 ----------- .../mso/requestsdb/RequestsDbConstant.java | 65 - .../RequestsDbSessionFactoryManager.java | 47 - .../mso/requestsdb/ResourceOperationStatus.java | 222 --- .../org/openecomp/mso/requestsdb/SiteStatus.java | 72 - .../WatchdogComponentDistributionStatus.java | 80 - .../WatchdogComponentDistributionStatusDb.java | 194 --- .../mso/requestsdb/WatchdogDistributionStatus.java | 71 - .../requestsdb/WatchdogDistributionStatusDb.java | 197 --- .../requestsdb/WatchdogServiceModVerIdLookup.java | 61 - .../WatchdogServiceModVerIdLookupDb.java | 124 -- .../requestsdb/adapter/TimestampXMLAdapter.java | 42 - .../src/main/resources/InfraActiveRequests.hbm.xml | 161 -- .../src/main/resources/OperationStatus.hbm.xml | 47 - .../OperationalEnvDistributionStatus.hbm.xml | 56 - .../OperationalEnvServiceModelStatus.hbm.xml | 54 - .../main/resources/ResourceOperationStatus.hbm.xml | 44 - .../src/main/resources/SiteStatus.hbm.xml | 37 - .../WatchdogComponentDistributionStatus.hbm.xml | 46 - .../resources/WatchdogDistributionStatus.hbm.xml | 46 - .../WatchdogServiceModVerIdLookup.hbm.xml | 38 - .../mso-requests-db/src/main/resources/beans.xml | 12 + .../hibernate-requests-core-mysql.cfg.xml | 44 - .../src/test/java/org/onap/so/TestApplication.java | 35 + .../onap/so/db/request/OperationStatusTest.java | 82 + .../OperationalEnvServiceModelStatusTest.java | 80 + .../org/onap/so/db/request/RequestDBConfig.java | 77 + .../org/onap/so/db/request/SiteStatusTest.java | 86 + .../org/onap/so/db/request/beans/BeansTest.java | 71 + .../mso/requestsdb/InfraRequestsTest.java | 129 -- .../mso/requestsdb/OperationStatusTest.java | 61 - .../OperationalEnvDistributionStatusDbTest.java | 112 -- .../OperationalEnvDistributionStatusTest.java | 249 --- .../OperationalEnvServiceModelStatusDbTest.java | 120 -- .../OperationalEnvServiceModelStatusTest.java | 271 ---- .../mso/requestsdb/RequestDatabaseTest.java | 40 - .../mso/requestsdb/RequestsDatabaseTest.java | 287 ---- .../requestsdb/ResourceOperationStatusTest.java | 58 - .../openecomp/mso/requestsdb/SiteStatusTest.java | 44 - .../WatchdogComponentDistributionStatusDbTest.java | 127 -- .../WatchdogComponentDistributionStatusTest.java | 177 --- .../WatchdogDistributionStatusDbTest.java | 124 -- .../requestsdb/WatchdogDistributionStatusTest.java | 150 -- .../WatchdogServiceModVerIdLookupDbTest.java | 86 - .../WatchdogServiceModVerIdLookupTest.java | 124 -- .../src/test/resources/application-test.yaml | 40 + .../src/test/resources/logback-test.xml | 46 + .../mso-requests-db/src/test/resources/schema.sql | 212 +++ mso-api-handlers/pom.xml | 13 +- 1008 files changed, 49082 insertions(+), 41742 deletions(-) create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/beans/avpnbondingbeans/AVPNServiceNames.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/BpmnRequest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBooleanInput.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBpmnRequestInput.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaInput.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaIntegerInput.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializer.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaRequest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/Track.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/LSInputImpl.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Messages.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/MsoException.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/BPMNFailureException.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ClientConnectionException.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RecipeNotFoundException.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/VfModuleNotFoundException.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/AlarmLoggerInfo.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBooleanInput.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaIntegerInput.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/Track.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ErrorNumbers.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/LSInputImpl.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/PathResourceResolver.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/package-info.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BeansTest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BpmnRequestTest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializerTest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/AllTestsTestSuite.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaTaskClientTest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandlerTest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionMapperTest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/TestAppender.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/camundabeans/BeansTest.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequestTest.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/common/CamundaTaskClientTest.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java delete mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java create mode 100644 mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json delete mode 100644 mso-api-handlers/mso-api-handler-common/src/test/resources/logback-test.xml delete mode 100644 mso-api-handlers/mso-api-handler-infra/WebContent/META-INF/MANIFEST.MF delete mode 100644 mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/beans.xml delete mode 100644 mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/jboss-deployment-structure.xml delete mode 100644 mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/jboss-web.xml delete mode 100644 mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/web.xml delete mode 100644 mso-api-handlers/mso-api-handler-infra/WebContent/check.html delete mode 100644 mso-api-handlers/mso-api-handler-infra/WebContent/index.xhtml create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/common/ResponseBuilder.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Actions.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Constants.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Messages.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ModelType.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoException.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RecipeLookupResult.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestActionMap.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SpringContextHelper.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Status.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TestApi.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/CatalogDBConfig.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/RequestDBConfig.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/CompareModelsRequest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/DelE2ESvcResp.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EParameters.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/LocationConstraint.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/VimLocation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/package-info.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/RequestDetails.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/RequestInfo.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskList.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskRequestReference.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariableValue.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariables.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TasksGetResponse.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/TasksRequest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/ValidResponses.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/Value.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tasksbeans/Variables.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/SDCClientCallFailed.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/TenantIsolationException.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Action.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/CloudOrchestrationRequestList.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/CloudOrchestrationResponse.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Distribution.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/DistributionStatus.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/InstanceReferences.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Manifest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RecoveryAction.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RelatedInstance.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RelatedInstanceList.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Request.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestDetails.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestInfo.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestList.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestParameters.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestReferences.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestStatus.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/ResourceType.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/ServiceModelList.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Status.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/TenantSyncResponse.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/package-info.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ApplyUpdatedConfigValidation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InPlaceSoftwareUpdateValidation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ModelInfoValidation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestInfoValidation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestScopeValidation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/SubscriberInfoValidation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationInformation.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationRule.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ActionType.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ModelType.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ObjectFactory.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/RequestInfo.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/RequestStatusType.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VfModuleModelName.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VfModuleModelNames.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfInputs.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfOutputs.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfRequest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfRequests.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfType.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/VnfTypes.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/package-info.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/InfraUtils.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ModelType.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoException.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/CompareModelsRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/DelE2ESvcResp.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EParameters.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EService.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceScaleRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EUserParam.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/LocationConstraint.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsByStepsData.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleNsData.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleResource.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/ScaleService.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/VimLocation.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponse.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/ModelDistributionRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/OperationalEnvironmentProcessFactory.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AsdcClientCallFailed.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/TenantIsolationException.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AsdcClientHelper.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/OperationalEnvironmentProcess.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Action.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationRequestList.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationResponse.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Distribution.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/DistributionStatus.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/InstanceReferences.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Manifest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RecoveryAction.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstance.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstanceList.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Request.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestDetails.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestInfo.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestList.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestParameters.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestReferences.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestStatus.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ResourceType.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ServiceModelList.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Status.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantSyncResponse.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/package-info.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ActionType.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ModelType.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelName.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfInputs.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfOutputs.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfType.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/resources/ManualTasks.xsd delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/resources/application.properties create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.onap.so.client.RestProperties create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.onap.so.client.grm.GRMProperties delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.grm.GRMProperties create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/index.html create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/index.html create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/install.html create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/jars.html create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/layout.html create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/logging.html create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/onaplogo.png create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/packaging.html create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/page.html create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/readme.css create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/spring.html create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/testing.html create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/tools.html create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/favicon-16x16.png create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/favicon-32x32.png create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/index.html create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/oauth2-redirect.html create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/swagger-ui-bundle.js create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/swagger-ui-standalone-preset.js create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/swagger-ui.css create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/swagger-ui.css.map create mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/swagger-ui.js delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/adv-feature-request.xml delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/adv-service-request.xml delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/feature-request.xml delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/service-request.xml delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/resources/xsd/ManualTasks.xsd create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/common/ResponseBuilderTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandlerTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/AllTestsTestSuite.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionMapperTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BeanMultiTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/EmbeddedCatalogDbConfig.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/EmbeddedRequestDbConfig.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/HealthCheckHandlerTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestActionMapTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstanceBeansTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TasksHandlerTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TestAppender.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/DelE2ESvcRespTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ERequestTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequestTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EUserParamTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/NsParametersTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/RequestDetailsTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/RequestInfoTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskListTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskRequestReferenceTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariableValueTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariablesTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TasksGetResponseTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TasksRequestTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/ValueTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/VariablesTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequestTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequestTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClientTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisherTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/SDCDmaapClientTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/SDCClientCallFailedTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/TenantIsolationExceptionTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilderTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelperTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolationbeans/TenantIsolationBeansTest.java create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeansTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandlerTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandlerTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResultTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RequestActionMapTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstancesTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/DelE2ESvcRespTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequestTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequestTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EUserParamTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParametersTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestDetailsTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestInfoTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskListTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskRequestReferenceTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariableValueTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariablesTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksGetResponseTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksRequestTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/ValueTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/VariablesTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetailsTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfoTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskListTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReferenceTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValueTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariablesTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponseTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequestTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValueTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/VariablesTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/ModelDistributionRequestTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRequestTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/AsdcDmaapClientTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClientTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisherTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilderTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AsdcClientHelperTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/mock/AaiStubResponse.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/mock/MockTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationBeansTest.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ActivateOperationEnvironment.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ActivateOperationEnvironmentInvalid.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ApplyUpdatedConfig.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/CloudConfiguration.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ConfigurationModelVersionId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/DeactivateOperationEnvironment.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/DeactivateOperationEnvironmentInvalid.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/E2EServiceInstancesTest/CompareModelRequest.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/E2EServiceInstancesTest/DeleteRequest.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/E2EServiceInstancesTest/Request.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/E2EServiceInstancesTest/ScaleRequest.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ECOMPOperationEnvironmentCreate.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptyCloudConfiguration.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptyGlobalSubscriberId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptyInstanceName.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptyLcpCloudConfiguration.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptyLineOfBusiness.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptyOwningEntityId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptyOwningEntityName.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptyPlatform.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptyProject.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptyRequestorId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptySource.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptySubscriberInfo.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptySubscriptionServiceType.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/EmptyTenantId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/InPlaceSoftwareUpdate.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/InPlaceSoftwareUpdateCloudConfiguration.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/InPlaceSoftwareUpdateCloudRegionId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/InPlaceSoftwareUpdateTenantId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/InvalidInstanceName.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/InvalidModelInvariantId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/LineOfBusiness.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelCustomizationId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelCustomizationIdPreload.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelCustomizationIdUsingPreload.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelInfoNull.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelInvariantId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelInvariantIdConfiguration.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelInvariantIdConfigurationDelete.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelInvariantIdFormat.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelInvariantIdService.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelInvariantIdServiceCreate.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelInvariantIdVnf.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelNameVersionId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelTypeNull.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelVersion.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelVersionId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelVersionIdCreate.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelVersionIdTest.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelVersionNetwork.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelVersionService.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ModelVersionVfModule.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/CloudConfiguration.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/CloudConfigurationConfig.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/CloudConfigurationNetwork.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/CloudConfigurationVnf.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/DeactivateAndCloudDeleteCloudConfiguration.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/EmptyCloudConfiguration.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/EmptyLcpCloudConfiguration.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/EmptyTenantId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateTenantId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ConfigurationModelVersionId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/InvalidModelInvariantId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelCustomization.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelCustomizationId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelCustomizationIdUsingPreload.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelCustomizationName.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelInfoNull.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelInvariantId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelInvariantIdConfiguration.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelInvariantIdConfigurationDelete.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelInvariantIdService.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelInvariantIdVnf.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelNameVersionId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelTypeNull.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelVersionId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelVersionIdCreate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelVersionNetwork.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelVersionService.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelVersionServiceCreate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ModelVersionVfModule.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ServiceModelNameEmptyOnActivate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ServiceModelNameEmptyOnDelete.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ValidModelCustomizationId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ValidModelCustomizationIdService.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VfModuleModelName.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfModelCustomizationId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfModelCustomizationIdEmpty.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfModelCustomizationIdPreload.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfModelCustomizationNameNull.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/VnfModelCustomizationTest.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/v2ModelVersionId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/v3UpdateNetworkBad.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/v4CreateVfModuleMissingModelCustomizationId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/v4CreateVfModuleNoCustomizationId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/v5ActivateModelVersionId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/v5CreateConfigurationModelCustomizationId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/v5DeactivateModelInvariantId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/v5ModelInvariantIdDisablePort.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/v5ModelInvariantIdNetwork.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/PlatformAndLineOfBusiness/EmptyLineOfBusiness.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/PlatformAndLineOfBusiness/EmptyPlatformName.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/PlatformAndLineOfBusiness/OptionalLineOfBusiness.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/PlatformAndLineOfBusiness/Platform.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/PlatformAndLineOfBusiness/PlatformAndLineOfBusiness.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/PlatformAndLineOfBusiness/PlatformTest.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ProjectAndOwningEntity/EmptyOwningEntityId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ProjectAndOwningEntity/EmptyOwningEntityName.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ProjectAndOwningEntity/EmptyProjectName.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ProjectAndOwningEntity/OptionalProject.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ProjectAndOwningEntity/OwningEntity.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ProjectAndOwningEntity/ProjectAndOwningEntity.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ProjectAndOwningEntity/ServiceAssignNoOE.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/InvalidInstanceName.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstances.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesIdFormat.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesInstanceId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesModelCustomizationId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesModelInfo.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesModelInvariantId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesModelInvariantIdFormat.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesModelName.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesModelType.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesModelVersion.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesModelVersionId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesNameFormat.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesServiceInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesVfModule.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesVnfInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/RelatedInstancesVnfInstanceId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/ServiceNoRelatedInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/VfModuleRelatedInstancesService.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/VfModuleRelatedInstancesVnf.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/VnfRelatedInstancesService.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/VolumeGroupRelatedInstances.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v4RelatedInstancesNull.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v5ActivateNoRelatedInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v5CreateNoDestinationRelatedInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v5CreateNoRelatedInstances.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v5CreateNoSourceRelatedInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v5DeactivateNoRelatedInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v5EnablePortNoConnectionPoint.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v5EnablePortNoRelatedInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6AddRelationshipsInstanceName.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6VnfDeleteInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v7CreateVnfNetworkCollection.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/EmptyRequestorId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/EmptySource.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/NetworkProductFamilyId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfo.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfoNull.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestorId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/ServiceProductFamilyId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/ServiceProductFamilyIdFlag.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/ServiceProductFamilyIdUpdate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/VnfProductFamilyId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/AssignCloudConfigVnf.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/AssignEmptyReqParameters.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/ProductFamilyId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/RequestParameters.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/RequestParametersALaCarteTrue.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/RequestParametersNull.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsModelCustomizationId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsModelInfo.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsModelVersionId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsPlatform.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsPlatformName.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsVnfModelInfo.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelCustomizationId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelVersionId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModules.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModulesModelInfo.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VnfModelCustomizationId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VnfModelVersionId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VnfRequestParameters.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/v2requestParametersALaCarteFalse.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/v3DeleteServiceInstanceALaCarte.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SubscriberInfo/AssignEmptySubscriberInfo.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SubscriberInfo/EmptyGlobalSubscriberId.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SubscriberInfo/EmptySubscriberInfo.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SubscriberInfo/EmptySubscriptionServiceType.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/InstanceIdHashMap.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/NetworkType.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceInPlaceSoftwareUpdate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceUnassign.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/UserParams.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/VfModulesModelInfo.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/VnfActivate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/v3DeleteNetwork.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/v3DeleteServiceInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/v3DeleteServiceInstanceALaCarte.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/v3UpdateNetwork.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/v3VnfCreate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/v4CreateVfModule.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/v5ActivateConfiguration.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/v5CreateConfiguration.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/v5DeactivateConfiguration.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/v5EnableConfiguration.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/v5EnableService.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/v6AddRelationships.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/v6CreateConfiguration.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/NetworkModelName.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/NetworkProductFamilyId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/NetworkType.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/AlaCarteRequest.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/Request.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequestHandler/SampleGetResponse.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/OwningEntity.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/Payload.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/Platform.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/PlatformAndLineOfBusiness.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/PlatformAndLineOfBusiness2.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/PlatformAndLineOfBusinessInvalid.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/PlatformAndLineOfBusinessInvalid2.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/PlatformTest.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/Project.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ProjectAndOwningEntity.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ProjectAndOwningEntity2.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ProjectAndOwningEntityInvalid.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ProjectAndOwningEntityInvalid2.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstances.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesIdFormat.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesInstanceDirection.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesInstanceId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesModelCustomizationId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesModelInfo.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesModelInvariantId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesModelInvariantIdFormat.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesModelName.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesModelType.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesModelVersion.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesModelVersionId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesNameFormat.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesServiceInstance.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesServiceInstanceId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesSetInstances.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesVfModule.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesVnfInstance.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RelatedInstancesVnfInstanceId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RequestInfo.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RequestInfoNull.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RequestParameters.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RequestParametersALaCarteNull.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RequestParametersALaCarteTrue.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RequestParametersNull.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/RequestorId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInPlaceSoftwareUpdate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/AddRelationships.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ApplyUpdatedConfig.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ConvertRequestFail.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeactivateAndCloudDeleteVfModule.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeleteVfModule.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeleteVnf.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeleteVnfV5.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeleteVolumeGroup.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/InPlaceSoftwareUpdate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/InPlaceSoftwareUpdate2.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/LegacyMacroServiceInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/MacroServiceInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkCreate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkCreateAlternateInstanceName.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkCreateTestApiGrApi.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkCreateTestApiIncorrect.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkCreateTestApiVnfApi.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstanceNoReqParams.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NoVnfResource.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/RemoveRelationships.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModule.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVnf.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVnfRecreate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceALaCarteTrue.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceALaCarteTrueNoRecipe.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceActivate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceActivatePort.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceBadGateway.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceDeactivate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceDeactivatePort.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceDefault.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceDelete.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceDisablePort.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceDuplicates.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceEmpty.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceEnablePort.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceMacro.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceNoRecipe.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceParseFail.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstancePortConfiguration.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstancePrev7.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstancePrev8.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceStatusError.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceRequestExpected.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceUnassign.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateNetwork.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateVfModule.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateVnf.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateVolumeGroup.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VfModuleInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VfModuleInvalid.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VfModuleNoMatchingModelUUID.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VfModuleNoModelCustomization.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VfModuleNoModelType.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VfModuleWithRelatedInstances.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VnfCreateDefault.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VnfWithServiceRelatedInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VnfWithServiceRelatedInstanceFail.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VnfWithVnfRelatedInstance.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VolumeGroup.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/userParams.txt delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceModelNameEmptyOnActivate.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceModelNameEmptyOnDelete.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceNoRelatedInstance.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceProductFamilyId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceProductFamilyIdFlag.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceProductFamilyIdUpdate.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/Source.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/TenantIsolation/ActivateOperationEnvironment.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/TenantIsolation/ActivateOperationEnvironmentInvalid.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/TenantIsolation/DeactivateOperationEnvironment.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/TenantIsolation/DeactivateOperationEnvironmentInvalid.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/TenantIsolation/ECOMPOperationEnvironmentCreate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/TenantIsolation/VNFOperationEnvironmentCreate.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/TenantIsolation/VNFOperationEnvironmentCreateInvalid.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/UserParams.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VNFOperationEnvironmentCreate.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VNFOperationEnvironmentCreateInvalid.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ValidModelCustomizationId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ValidModelCustomizationIdService.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VfModuleModelName.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VfModuleModelNameEmpty.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VfModuleModelNameEmptyOnDelete.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VfModuleModelNameEmptyOnUpdate.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VfModuleRelatedInstancesService.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VfModuleRelatedInstancesVnf.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VfModuleVnfInstance.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfActivate.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfModelCustomizationId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfModelCustomizationIdEmpty.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfModelCustomizationIdPreload.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfModelCustomizationIdValid.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfModelCustomizationName.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfModelCustomizationNameNull.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfModelCustomizationNotValid.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfModelCustomizationTest.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfModelName.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfProductFamilyId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfRelatedInstancesInstanceDirection.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfRelatedInstancesService.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VnfRequestParameters.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/VolumeGroupRelatedInstances.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/AVPNBPMNErrorResponse.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/AVPNBPMNResponse.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/AsyncProcessResponse.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/BPMNResponse.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/ErrorBPEL.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/GetTaskResponse.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/GetTaskVariablesResponse.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/SuccessfulResponse.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/TestResponse.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/TestResponseInvalid.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/TestResponseInvalid2.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/PlatformAndLineOfBusiness.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/logging.properties delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/mso.apihandler-infra.properties create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/org/onap/so/client/asdc/create-ecompoe/ecomp-openv-request.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/org/openecomp/mso/client/asdc/create-ecompoe/ecomp-openv-request.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v2AutoBuildVfModulesFalse.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v2AutoBuildVfModulesTrue.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v2ModelVersionId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v2VfModuleModelNameEmptyOnDelete.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v2requestParametersALaCarteFalse.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v3DeleteNetwork.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v3DeleteServiceInstance.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v3DeleteServiceInstanceALaCarte.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v3DeleteServiceInstanceBad.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v3UpdateNetwork.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v3UpdateNetworkBad.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v3VnfCreate.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v3VolumeGroupBad.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModule.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleMissingModelCustomizationId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v4CreateVfModuleNoCustomizationId.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5ActivatePortMirrorBadData.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5ActivatePortMirrorConfiguration.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5ActivatePortMirrorNoRelatedInstance.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5DeactivatePortMirrorBadData.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5DeactivatePortMirrorConfiguration.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5DeactivatePortMirrorNoRelatedInstance.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5EnablePortMirrorConfiguration.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5EnablePortMirrorNoConnectionPoint.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5EnablePortMirrorNoRelatedInstance.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5EnablePortMirrorService.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5ModelInvariantIdDisablePort.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5ModelInvariantIdNetwork.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5PortMirrorCreateConfiguration.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5PortMirrorCreateConfigurationBad.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5PortMirrorCreateNoDestinationRelatedInstance.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5PortMirrorCreateNoRelatedInstances.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v5PortMirrorCreateNoSourceRelatedInstance.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v6AddRelationships.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v6AddRelationshipsBadData.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v6PortMirrorCreateConfiguration.json delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/v6VnfDeleteInstance.json create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ArchivedInfraRequests.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatus.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatusId.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvDistributionStatus.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatusId.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatus.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatusId.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/Status.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatus.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatusId.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookupId.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDbConstant.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/adapter/TimestampXMLAdapter.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraActiveRequests.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationStatus.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatus.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusDb.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatus.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDb.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDBHelper.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbConstant.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbSessionFactoryManager.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/ResourceOperationStatus.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/SiteStatus.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatus.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDb.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatus.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDb.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookup.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDb.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/adapter/TimestampXMLAdapter.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml delete mode 100644 mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml delete mode 100644 mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvDistributionStatus.hbm.xml delete mode 100644 mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvServiceModelStatus.hbm.xml delete mode 100644 mso-api-handlers/mso-requests-db/src/main/resources/ResourceOperationStatus.hbm.xml delete mode 100644 mso-api-handlers/mso-requests-db/src/main/resources/SiteStatus.hbm.xml delete mode 100644 mso-api-handlers/mso-requests-db/src/main/resources/WatchdogComponentDistributionStatus.hbm.xml delete mode 100644 mso-api-handlers/mso-requests-db/src/main/resources/WatchdogDistributionStatus.hbm.xml delete mode 100644 mso-api-handlers/mso-requests-db/src/main/resources/WatchdogServiceModVerIdLookup.hbm.xml create mode 100644 mso-api-handlers/mso-requests-db/src/main/resources/beans.xml delete mode 100644 mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml create mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java create mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationStatusTest.java create mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java create mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/RequestDBConfig.java create mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/SiteStatusTest.java create mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/beans/BeansTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/InfraRequestsTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationStatusTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusDbTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDbTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestDatabaseTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/ResourceOperationStatusTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/SiteStatusTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDbTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDbTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDbTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupTest.java create mode 100644 mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml create mode 100644 mso-api-handlers/mso-requests-db/src/test/resources/logback-test.xml create mode 100644 mso-api-handlers/mso-requests-db/src/test/resources/schema.sql (limited to 'mso-api-handlers') diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml index 6ca1f3de28..b1963f1f4c 100644 --- a/mso-api-handlers/mso-api-handler-common/pom.xml +++ b/mso-api-handlers/mso-api-handler-common/pom.xml @@ -5,62 +5,150 @@ org.onap.so mso-api-handlers - 1.2.0-SNAPSHOT + 1.3.0-SNAPSHOT + mso-api-handler-common - ECOMP MSO API Handler common - ECOMP MSO API Handler common classes + mso-api-handler-common + ONAP SO API Handler Common Libraries UTF-8 UTF-8 + 1.3.0 + 1.1.1 + 3.2.4 + 3.0.0 + 0.9.9-RC1 + 2.5.2 + 1.0.3 + 1.9.2 + 1.8 - + + + + + org.springframework.boot + spring-boot-dependencies + ${springboot.version} + pom + import + + + - - commons-io - commons-io + org.springframework.boot + spring-boot-starter-jersey - - javax - javaee-web-api - 6.0 - provided + commons-lang + commons-lang + 2.6 + + + antlr + antlr - - javax.activation activation 1.1.1 - provided - - org.onap.so - mso-catalog-db - ${project.version} + javax.transaction + jta + 1.1 - - org.onap.so - mso-requests-db - ${project.version} + org.json4s + json4s-jackson_2.9.1-1 + ${json4s-jackson-version} + + + org.json4s + json4s-core_2.9.2 + ${json4s-core-version} + + + com.fasterxml.jackson.core + jackson-databind - org.assertj - assertj-core - 3.10.0 + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-annotations + + + javax.servlet + servlet-api + 2.5 + + + org.javassist + javassist + + + org.json + json + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-base + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-providers + 2.9.2 + pom + + + org.springframework.boot + spring-boot-starter-test test - + + commons-beanutils + commons-beanutils + + + org.springframework.boot + spring-boot-configuration-processor + true + + + com.googlecode.junit-toolbox + junit-toolbox + 2.4 + + + org.onap.so + common + ${project.version} + + ${project.artifactId}-${project.version} - + + + org.apache.maven.plugins + maven-surefire-plugin + + + default-test + + test + + + + + jar diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/beans/avpnbondingbeans/AVPNServiceNames.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/beans/avpnbondingbeans/AVPNServiceNames.java new file mode 100644 index 0000000000..ed4e8c9305 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/beans/avpnbondingbeans/AVPNServiceNames.java @@ -0,0 +1,44 @@ +/*- + * ============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.beans.avpnbondingbeans; + +public enum AVPNServiceNames { + AVPN_BONDING_TO_COLLABORATE("AVPNBondingToCollaborate"), + AVPN_BONDING_TO_IP_FLEX_REACH("AVPNBondingToIPFlexReach"), + AVPN_BONDING_TO_IP_TOLL_FREE("AVPNBondingToIPTollFree"); + + private String serviceName; + + AVPNServiceNames(String serviceName){ + this.serviceName=serviceName; + } + + public String getServiceName() { + return serviceName; + } + + @Override + public String toString() { + return "AVPNServiceNames{" + + "serviceName='" + serviceName + '\'' + + '}'; + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/BpmnRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/BpmnRequest.java new file mode 100644 index 0000000000..bc2e5b1893 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/BpmnRequest.java @@ -0,0 +1,252 @@ +/*- + * ============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.camundabeans; + +import org.onap.so.apihandler.common.CommonConstants; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * JavaBean JSON class for a "bpmnRequest" which contains the JSON payload that + * will be passed to the Camunda process + */ +@JsonPropertyOrder({CommonConstants.REQUEST_ID_VARIABLE, + CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE, + CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_ID_VARIABLE, + CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE, + CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE, + CommonConstants.SERVICE_TYPE_VARIABLE, CommonConstants.VNF_TYPE_VARIABLE, + CommonConstants.VF_MODULE_TYPE_VARIABLE, CommonConstants.NETWORK_TYPE_VARIABLE, + CommonConstants.REQUEST_DETAILS_VARIABLE}) +@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT) +public class BpmnRequest { + + @JsonProperty(CommonConstants.CAMUNDA_HOST) + private CamundaInput host; + + @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE) + private CamundaInput requestId; + + @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) + private CamundaBooleanInput isBaseVfModule; + + @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE) + private CamundaIntegerInput recipeTimeout; + + @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE) + private CamundaInput requestAction; + + @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) + private CamundaInput serviceInstanceId; + + @JsonProperty(CommonConstants.VNF_ID_VARIABLE) + private CamundaInput vnfId; + + @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE) + private CamundaInput vfModuleId; + + @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE) + private CamundaInput volumeGroupId; + + @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE) + private CamundaInput networkId; + + @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE) + private CamundaInput serviceType; + + @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE) + private CamundaInput vnfType; + + @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE) + private CamundaInput vfModuleType; + + @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE) + private CamundaInput networkType; + + @JsonProperty(CommonConstants.REQUEST_DETAILS_VARIABLE) + private CamundaInput requestDetails; + + public BpmnRequest() { + /* Empty constructor */ + + } + + @JsonProperty(CommonConstants.CAMUNDA_HOST) + public CamundaInput getHost() { + return host; + } + + @JsonProperty(CommonConstants.CAMUNDA_HOST) + public void setHost(CamundaInput host) { + this.host = host; + } + + @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE) + public CamundaInput getRequestId() { + return requestId; + } + + @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE) + public void setRequestId(CamundaInput requestId) { + this.requestId = requestId; + } + + @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) + public CamundaBooleanInput getIsBaseVfModule() { + return isBaseVfModule; + } + + @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) + public void setIsBaseVfModule(CamundaBooleanInput isBaseVfModule) { + this.isBaseVfModule = isBaseVfModule; + } + + @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE) + public CamundaIntegerInput getRecipeTimeout() { + return recipeTimeout; + } + + @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE) + public void setRecipeTimeout(CamundaIntegerInput recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } + + @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE) + public CamundaInput getRequestAction() { + return requestAction; + } + + @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE) + public void setRequestAction(CamundaInput requestAction) { + this.requestAction = requestAction; + } + @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) + public CamundaInput getServiceInstanceId() { + return serviceInstanceId; + } + + @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) + public void setServiceInstanceId(CamundaInput serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + @JsonProperty(CommonConstants.VNF_ID_VARIABLE) + public CamundaInput getVnfId() { + return vnfId; + } + + @JsonProperty(CommonConstants.VNF_ID_VARIABLE) + public void setVnfId(CamundaInput vnfId) { + this.vnfId = vnfId; + } + + @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE) + public CamundaInput getVfModuleId() { + return vfModuleId; + } + + @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE) + public void setVfModuleId(CamundaInput vfModuleId) { + this.vfModuleId = vfModuleId; + } + + @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE) + public CamundaInput getVolumeGroupId() { + return volumeGroupId; + } + + @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE) + public void setVolumeGroupId(CamundaInput volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE) + public CamundaInput getNetworkId() { + return networkId; + } + + @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE) + public void setNetworkId(CamundaInput networkId) { + this.networkId = networkId; + } + + @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE) + public CamundaInput getServiceType() { + return serviceType; + } + + @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE) + public void setServiceType(CamundaInput serviceType) { + this.serviceType = serviceType; + } + + @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE) + public CamundaInput getVnfType() { + return vnfType; + } + + @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE) + public void setVnfType(CamundaInput vnfType) { + this.vnfType = vnfType; + } + + @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE) + public CamundaInput getVfModuleType() { + return vfModuleType; + } + + @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE) + public void setVfModuleType(CamundaInput vfModuleType) { + this.vfModuleType = vfModuleType; + } + + @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE) + public CamundaInput getNetworkType() { + return networkType; + } + + @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE) + public void setNetworkType(CamundaInput networkType) { + this.networkType = networkType; + } + + @JsonProperty(CommonConstants.REQUEST_DETAILS_VARIABLE) + public CamundaInput getRequestDetails() { + return requestDetails; + } + + @JsonProperty(CommonConstants.REQUEST_DETAILS_VARIABLE) + public void setRequestDetails(CamundaInput requestDetails) { + this.requestDetails = requestDetails; + } + + + + + @Override + public String toString() { + + return "BpmnRequest"; + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBooleanInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBooleanInput.java new file mode 100644 index 0000000000..ea44375ff7 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBooleanInput.java @@ -0,0 +1,72 @@ +/*- + * ============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.camundabeans; + + + +import org.onap.so.apihandler.common.CommonConstants; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that + * will be passed to the Camunda process + */ + + +public class CamundaBooleanInput { + + @JsonProperty(CommonConstants.CAMUNDA_VALUE) + private boolean value; + @JsonProperty(CommonConstants.CAMUNDA_TYPE) + private String type = "Boolean"; + + + public CamundaBooleanInput() { + } + + @JsonProperty(CommonConstants.CAMUNDA_VALUE) + public boolean getValue() { + return value; + } + + @JsonProperty(CommonConstants.CAMUNDA_VALUE) + public void setValue(boolean value) { + this.value = value; + } + + @JsonProperty(CommonConstants.CAMUNDA_TYPE) + public String getType() { + return type; + } + + @JsonProperty(CommonConstants.CAMUNDA_TYPE) + public void setType(String type) { + this.type = type; + } + + @Override + public String toString() { + return "CamundaInput [value=" + value + ", type=" + type + "]"; + } + + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBpmnRequestInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBpmnRequestInput.java new file mode 100644 index 0000000000..25293c7807 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBpmnRequestInput.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========================================================= + */ + +package org.onap.so.apihandler.camundabeans; + + + +import org.onap.so.apihandler.common.CommonConstants; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that + * will be passed to the Camunda process + */ +public class CamundaBpmnRequestInput { + + @JsonProperty(CommonConstants.CAMUNDA_VALUE) + private BpmnRequest value; + @JsonProperty(CommonConstants.CAMUNDA_TYPE) + private String type = "String"; + + + public CamundaBpmnRequestInput() { + /* Empty constructor */ + } + + @JsonProperty(CommonConstants.CAMUNDA_VALUE) + public BpmnRequest getValue() { + return value; + } + + @JsonProperty(CommonConstants.CAMUNDA_VALUE) + public void setValue(BpmnRequest value) { + this.value = value; + } + + @JsonProperty(CommonConstants.CAMUNDA_TYPE) + public String getType() { + return type; + } + + @JsonProperty(CommonConstants.CAMUNDA_TYPE) + public void setType(String type) { + this.type = type; + } + + @Override + public String toString() { + return "CamundaInput [value=" + value + ", type=" + type + "]"; + } + + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaInput.java new file mode 100644 index 0000000000..29e72e005a --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaInput.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.apihandler.camundabeans; + + + + +import org.onap.so.apihandler.common.CommonConstants; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that + * will be passed to the Camunda process + * + */ + + +public class CamundaInput { + + @JsonProperty(CommonConstants.CAMUNDA_VALUE) + private String value; + + + @JsonProperty(CommonConstants.CAMUNDA_TYPE) + private String type = "String"; + + + @JsonProperty(CommonConstants.CAMUNDA_VALUE) + public String getValue() { + return value; + } + + @JsonProperty(CommonConstants.CAMUNDA_TYPE) + public String getType() { + return type; + } + + @JsonProperty(CommonConstants.CAMUNDA_TYPE) + public void setType(String type) { + this.type = type; + } + + @JsonProperty(CommonConstants.CAMUNDA_VALUE) + public void setValue(String value) { + this.value = value; + } + + @Override + public String toString() { + return "CamundaInput [value=" + value + ", type=" + type + "]"; + } + + + + + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaIntegerInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaIntegerInput.java new file mode 100644 index 0000000000..5bcfc6fb53 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaIntegerInput.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========================================================= + */ + +package org.onap.so.apihandler.camundabeans; + + + +import org.onap.so.apihandler.common.CommonConstants; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that + * will be passed to the Camunda process + */ +public class CamundaIntegerInput { + + @JsonProperty(CommonConstants.CAMUNDA_VALUE) + private int value; + + @JsonProperty(CommonConstants.CAMUNDA_TYPE) + private String type = "Integer"; + + + public CamundaIntegerInput() { + } + + @JsonProperty(CommonConstants.CAMUNDA_VALUE) + public int getValue() { + return value; + } + + @JsonProperty(CommonConstants.CAMUNDA_VALUE) + public void setValue(int value) { + this.value = value; + } + + @JsonProperty(CommonConstants.CAMUNDA_TYPE) + public String getType() { + return type; + } + + @JsonProperty(CommonConstants.CAMUNDA_TYPE) + public void setType(String type) { + this.type = type; + } + + @Override + public String toString() { + return "CamundaInput [value=" + Integer.toString(value) + ", type=" + type + "]"; + } + + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequest.java new file mode 100644 index 0000000000..c57c0965b9 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequest.java @@ -0,0 +1,107 @@ +/*- + * ============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.camundabeans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.onap.so.apihandler.common.CommonConstants; + +/** + * POJO which encapsulates the fields required to create a JSON request to invoke generic macro BPEL. + */ +@JsonPropertyOrder({CommonConstants.G_REQUEST_ID, CommonConstants.G_ACTION}) +@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT) +public class CamundaMacroRequest { + + @JsonProperty(CommonConstants.G_REQUEST_ID) + private CamundaInput requestId; + + @JsonProperty(CommonConstants.G_ACTION) + private CamundaInput action; + + @JsonProperty(CommonConstants.G_SERVICEINSTANCEID) + private CamundaInput serviceInstanceId; + + + /** + * Sets new requestId. + * + * @param requestId New value of requestId. + */ + public void setRequestId(CamundaInput requestId) { + this.requestId = requestId; + } + + /** + * Gets action. + * + * @return Value of action. + */ + public CamundaInput getAction() { + return action; + } + + /** + * Sets new action. + * + * @param action New value of action. + */ + public void setAction(CamundaInput action) { + this.action = action; + } + + /** + * Gets requestId. + * + * @return Value of requestId. + */ + public CamundaInput getRequestId() { + return requestId; + } + + /** + * Sets new serviceInstanceId. + * + * @param serviceInstanceId New value of serviceInstanceId. + */ + public void setServiceInstanceId(CamundaInput serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + /** + * Gets serviceInstanceId. + * + * @return Value of serviceInstanceId. + */ + public CamundaInput getServiceInstanceId() { + return serviceInstanceId; + } + + @Override + public String toString() { + return "CamundaMacroRequest{" + + "requestId=" + requestId + + ", action=" + action + + ", serviceInstanceId=" + serviceInstanceId + + '}'; + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializer.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializer.java new file mode 100644 index 0000000000..81adb40498 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializer.java @@ -0,0 +1,50 @@ +/*- + * ============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.camundabeans; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +/** + * Class used to create data object and serialize it to JSON which the BPEL macro flow understands. + */ +public class CamundaMacroRequestSerializer { + + private CamundaMacroRequestSerializer(){} + + public static String getJsonRequest(String requestId, String action, String serviceInstanceId)throws JsonProcessingException{ + CamundaMacroRequest macroRequest = new CamundaMacroRequest(); + macroRequest.setAction(getCamundaInput(action)); + macroRequest.setRequestId(getCamundaInput(requestId)); + macroRequest.setServiceInstanceId(getCamundaInput(serviceInstanceId)); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + return mapper.writeValueAsString(macroRequest); + } + + private static CamundaInput getCamundaInput(String value){ + CamundaInput input = new CamundaInput(); + input.setType("String"); + input.setValue(value); + return input; + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaRequest.java new file mode 100644 index 0000000000..48eeede7b3 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaRequest.java @@ -0,0 +1,135 @@ +/*- + * ============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.camundabeans; + + + + + +import org.onap.so.apihandler.common.CommonConstants; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * JavaBean JSON class for a "variables" which contains the xml payload that + * will be passed to the Camunda process + * + */ +@JsonPropertyOrder({ CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.CAMUNDA_HOST, + CommonConstants.SCHEMA_VERSION_HEADER, CommonConstants.REQUEST_ID_HEADER, CommonConstants.SERVICE_INSTANCE_ID_HEADER, + CommonConstants. REQUEST_TIMEOUT_HEADER, CommonConstants.CAMUNDA_SERVICE_INPUT}) +@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT) +public class CamundaRequest { + + @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) + private CamundaInput serviceInput; + + @JsonProperty(CommonConstants.CAMUNDA_HOST) + private CamundaInput host; + + @JsonProperty(CommonConstants.SCHEMA_VERSION_HEADER) + private CamundaInput schema; + + @JsonProperty(CommonConstants.REQUEST_ID_HEADER) + private CamundaInput reqid; + + @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_HEADER) + private CamundaInput svcid; + + @JsonProperty(CommonConstants.REQUEST_TIMEOUT_HEADER) + private CamundaInput timeout; + + public CamundaRequest() { + } + + @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) + public CamundaInput getServiceInput() { + return serviceInput; + } + + @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) + public void setServiceInput(CamundaInput serviceInput) { + this.serviceInput = serviceInput; + } + + @JsonProperty(CommonConstants.CAMUNDA_HOST) + public CamundaInput getHost() { + return host; + } + + @JsonProperty(CommonConstants.CAMUNDA_HOST) + public void setHost(CamundaInput host) { + this.host = host; + } + + @JsonProperty(CommonConstants.SCHEMA_VERSION_HEADER) + public CamundaInput getSchema() { + return schema; + } + + @JsonProperty(CommonConstants.SCHEMA_VERSION_HEADER) + public void setSchema(CamundaInput schema) { + this.schema = schema; + } + + @JsonProperty(CommonConstants.REQUEST_ID_HEADER) + public CamundaInput getReqid() { + return reqid; + } + + @JsonProperty(CommonConstants.REQUEST_ID_HEADER) + public void setReqid(CamundaInput reqid) { + this.reqid = reqid; + } + + @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_HEADER) + public CamundaInput getSvcid() { + return svcid; + } + + @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_HEADER) + public void setSvcid(CamundaInput svcid) { + this.svcid = svcid; + } + + + @JsonProperty(CommonConstants.REQUEST_TIMEOUT_HEADER) + public CamundaInput getTimeout() { + return timeout; + } + + @JsonProperty(CommonConstants.REQUEST_TIMEOUT_HEADER) + public void setTimeout(CamundaInput timeout) { + this.timeout = timeout; + } + + + + @Override + public String toString() { + return "CamundaRequest [serviceInput=" + serviceInput + ", host=" + + host + ", schema=" + schema + ", reqid=" + reqid + ", svcid=" + + svcid + ", timeout=" + timeout + "]"; + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java new file mode 100644 index 0000000000..92f4542b82 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.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.apihandler.camundabeans; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * JavaBean JSON class for a "variables" which contains the xml payload that + * will be passed to the Camunda process + * + */ + +public class CamundaResponse { + + @JsonProperty("response") + private String response; + @JsonProperty("messageCode") + private int messageCode; + @JsonProperty("message") + private String message; + @JsonProperty("processInstanceID") + private String processInstanceID; + @JsonProperty("variables") + private String variables; + + public String getProcessInstanceID() { + return processInstanceID; + } + + public void setProcessInstanceID(String processInstanceID) { + this.processInstanceID = processInstanceID; + } + + public String getVariables() { + return variables; + } + + public void setVariables(String variables) { + this.variables = variables; + } + + public CamundaResponse() { + } + + public String getResponse() { + return response; + } + + public void setResponse(String response) { + this.response = response; + } + + public int getMessageCode() { + return messageCode; + } + + public void setMessageCode(int messageCode) { + this.messageCode = messageCode; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @Override + public String toString() { + return "CamundaResponse [response=" + response + ", messageCode=" + + messageCode + ", message=" + message + "]"; + } + + + + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java new file mode 100644 index 0000000000..9099b48f11 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java @@ -0,0 +1,338 @@ +/*- + * ============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.camundabeans; + + +import org.onap.so.apihandler.common.CommonConstants; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * JavaBean JSON class for a "variables" which contains the JSON payload that + * will be passed to the Camunda process + */ +@JsonPropertyOrder({CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.REQUEST_ID_VARIABLE, + CommonConstants.REQUEST_ID_HEADER, + CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE, + CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_ID_VARIABLE, + CommonConstants.CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE, + CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE, + CommonConstants.CONFIGURATION_ID_VARIABLE, CommonConstants.SERVICE_TYPE_VARIABLE, + CommonConstants.VNF_TYPE_VARIABLE, CommonConstants.VF_MODULE_TYPE_VARIABLE, + CommonConstants.NETWORK_TYPE_VARIABLE, CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.RECIPE_PARAMS}) + +@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT) +public class CamundaVIDRequest { + + @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) + private CamundaInput serviceInput; + + @JsonProperty(CommonConstants.CAMUNDA_HOST) + private CamundaInput host; + + @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE) + private CamundaInput requestId; + + @JsonProperty(CommonConstants.REQUEST_ID_HEADER) + private CamundaInput msoRequestId; + + @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) + private CamundaBooleanInput isBaseVfModule; + + @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE) + private CamundaIntegerInput recipeTimeout; + + @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE) + private CamundaInput requestAction; + + @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) + private CamundaInput serviceInstanceId; + + @JsonProperty(CommonConstants.CORRELATION_ID) + private CamundaInput correlationId; + + @JsonProperty(CommonConstants.VNF_ID_VARIABLE) + private CamundaInput vnfId; + + @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE) + private CamundaInput vfModuleId; + + @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE) + private CamundaInput volumeGroupId; + + @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE) + private CamundaInput networkId; + + @JsonProperty(CommonConstants.CONFIGURATION_ID_VARIABLE) + private CamundaInput configurationId; + + @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE) + private CamundaInput serviceType; + + @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE) + private CamundaInput vnfType; + + @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE) + private CamundaInput vfModuleType; + + @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE) + private CamundaInput networkType; + + @JsonProperty(CommonConstants.RECIPE_PARAMS) + private CamundaInput recipeParams; + + @JsonProperty(CommonConstants.API_VERSION) + private CamundaInput apiVersion; + + @JsonProperty(CommonConstants.ALACARTE) + private CamundaBooleanInput aLaCarte; + + @JsonProperty(CommonConstants.REQUEST_URI) + private CamundaInput requestUri; + + @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) + public CamundaInput getServiceInput() { + return serviceInput; + } + + @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) + public void setServiceInput(CamundaInput serviceInput) { + this.serviceInput = serviceInput; + } + + @JsonProperty(CommonConstants.CAMUNDA_HOST) + public CamundaInput getHost() { + return host; + } + + @JsonProperty(CommonConstants.CAMUNDA_HOST) + public void setHost(CamundaInput host) { + this.host = host; + } + + @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE) + public CamundaInput getRequestId() { + return requestId; + } + + @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE) + public void setRequestId(CamundaInput requestId) { + this.requestId = requestId; + } + + @JsonProperty(CommonConstants.REQUEST_ID_HEADER) + public CamundaInput getMsoRequestId() { + return msoRequestId; + } + + @JsonProperty(CommonConstants.REQUEST_ID_HEADER) + public void setMsoRequestId(CamundaInput msoRequestIdp) { + this.msoRequestId = msoRequestIdp; + } + + @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) + public CamundaBooleanInput getIsBaseVfModule() { + return isBaseVfModule; + } + + @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) + public void setIsBaseVfModule(CamundaBooleanInput isBaseVfModule) { + this.isBaseVfModule = isBaseVfModule; + } + + @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE) + public CamundaIntegerInput getRecipeTimeout() { + return recipeTimeout; + } + + @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE) + public void setRecipeTimeout(CamundaIntegerInput recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } + + @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE) + public CamundaInput getRequestAction() { + return requestAction; + } + + @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE) + public void setRequestAction(CamundaInput requestAction) { + this.requestAction = requestAction; + } + @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) + public CamundaInput getServiceInstanceId() { + return serviceInstanceId; + } + + @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) + public void setServiceInstanceId(CamundaInput serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + @JsonProperty(CommonConstants.CORRELATION_ID) + public CamundaInput getCorrelationId() { + return correlationId; + } + + @JsonProperty(CommonConstants.CORRELATION_ID) + public void setCorrelationId(CamundaInput correlationId) { + this.correlationId = correlationId; + } + + @JsonProperty(CommonConstants.VNF_ID_VARIABLE) + public CamundaInput getVnfId() { + return vnfId; + } + + @JsonProperty(CommonConstants.VNF_ID_VARIABLE) + public void setVnfId(CamundaInput vnfId) { + this.vnfId = vnfId; + } + + @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE) + public CamundaInput getVfModuleId() { + return vfModuleId; + } + + @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE) + public void setVfModuleId(CamundaInput vfModuleId) { + this.vfModuleId = vfModuleId; + } + + @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE) + public CamundaInput getVolumeGroupId() { + return volumeGroupId; + } + + @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE) + public void setVolumeGroupId(CamundaInput volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE) + public CamundaInput getNetworkId() { + return networkId; + } + + @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE) + public void setNetworkId(CamundaInput networkId) { + this.networkId = networkId; + } + + @JsonProperty(CommonConstants.CONFIGURATION_ID_VARIABLE) + public CamundaInput getConfigurationId() { + return configurationId; + } + + @JsonProperty(CommonConstants.CONFIGURATION_ID_VARIABLE) + public void setConfigurationId(CamundaInput configurationId) { + this.configurationId = configurationId; + } + + @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE) + public CamundaInput getServiceType() { + return serviceType; + } + + @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE) + public void setServiceType(CamundaInput serviceType) { + this.serviceType = serviceType; + } + + @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE) + public CamundaInput getVnfType() { + return vnfType; + } + + @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE) + public void setVnfType(CamundaInput vnfType) { + this.vnfType = vnfType; + } + + @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE) + public CamundaInput getVfModuleType() { + return vfModuleType; + } + + @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE) + public void setVfModuleType(CamundaInput vfModuleType) { + this.vfModuleType = vfModuleType; + } + + @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE) + public CamundaInput getNetworkType() { + return networkType; + } + + @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE) + public void setNetworkType(CamundaInput networkType) { + this.networkType = networkType; + } + + @JsonProperty(CommonConstants.API_VERSION) + public CamundaInput getApiVersion() { + return apiVersion; + } + + @JsonProperty(CommonConstants.API_VERSION) + public void setApiVersion(CamundaInput apiVersion) { + this.apiVersion = apiVersion; + } + + @JsonProperty(CommonConstants.ALACARTE) + public CamundaBooleanInput getaLaCarte() { + return aLaCarte; + } + + @JsonProperty(CommonConstants.ALACARTE) + public void setaLaCarte(CamundaBooleanInput aLaCarte) { + this.aLaCarte = aLaCarte; + } + + @JsonProperty(CommonConstants.REQUEST_URI) + public CamundaInput getRequestUri() { + return requestUri; + } + + @JsonProperty(CommonConstants.REQUEST_URI) + public void setRequestUri(CamundaInput requestUri) { + this.requestUri = requestUri; + } + + public CamundaInput getRecipeParams() { + return recipeParams; + } + + public void setRecipeParams(CamundaInput recipeParams) { + this.recipeParams = recipeParams; + } + + @Override + public String toString() { + //return "CamundaRequest [requestId=" + + ", host=" + // + host + ", schema=" + schema + ", reqid=" + reqid + ", svcid=" + // + svcid + ", timeout=" + timeout + "]"; + return "CamundaRequest"; + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/Track.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/Track.java new file mode 100644 index 0000000000..3d4dc85089 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/Track.java @@ -0,0 +1,49 @@ +/*- + * ============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.camundabeans; + +public class Track { + + String title; + String singer; + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getSinger() { + return singer; + } + + public void setSinger(String singer) { + this.singer = singer; + } + + @Override + public String toString() { + return "Track [title=" + title + ", singer=" + singer + "]"; + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java new file mode 100644 index 0000000000..7feb1ae758 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java @@ -0,0 +1,278 @@ +/*- + * ============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.common; + + +import java.io.IOException; + +import javax.xml.bind.DatatypeConverter; + +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.onap.so.apihandler.camundabeans.CamundaBooleanInput; +import org.onap.so.apihandler.camundabeans.CamundaInput; +import org.onap.so.apihandler.camundabeans.CamundaIntegerInput; +import org.onap.so.apihandler.camundabeans.CamundaRequest; +import org.onap.so.apihandler.camundabeans.CamundaVIDRequest; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +public class CamundaClient extends RequestClient{ + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaClient.class); + private static final String CAMUNDA_URL_MESAGE = "Camunda url is: "; + + public CamundaClient() { + super(CommonConstants.CAMUNDA); + } + + + @Override + public HttpResponse post(String camundaReqXML, String requestId, + String requestTimeout, String schemaVersion, String serviceInstanceId, String action) + throws ClientProtocolException, IOException{ + HttpPost post = new HttpPost(url); + msoLogger.debug(CAMUNDA_URL_MESAGE + url); + String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion); + + StringEntity input = new StringEntity(jsonReq); + input.setContentType(CommonConstants.CONTENT_TYPE_JSON); + msoLogger.info("Camunda Request Content: " + jsonReq); + String encryptedCredentials = null; + if(props!=null){ + encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH); + if(encryptedCredentials != null){ + String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY); + if(userCredentials != null){ + post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); + } + } + } + + post.setEntity(input); + HttpResponse response = client.execute(post); + msoLogger.debug("Response is: " + response); + + return response; + } + + @Override + public HttpResponse post(String jsonReq) + throws ClientProtocolException, IOException{ + HttpPost post = new HttpPost(url); + msoLogger.debug(CAMUNDA_URL_MESAGE + url); + //String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion); + + StringEntity input = new StringEntity(jsonReq); + input.setContentType(CommonConstants.CONTENT_TYPE_JSON); + + String encryptedCredentials = null; + if(props!=null){ + encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH); + if(encryptedCredentials != null){ + String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY); + if(userCredentials != null){ + post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); + } + } + } + + post.setEntity(input); + HttpResponse response = client.execute(post); + msoLogger.debug("Response is: " + response); + + return response; + } + + public HttpResponse post(RequestClientParameter parameterObject) + throws ClientProtocolException, IOException{ + HttpPost post = new HttpPost(url); + msoLogger.debug("Camunda url is: "+ url); + String jsonReq = wrapVIDRequest(parameterObject.getRequestId(), parameterObject.isBaseVfModule(), parameterObject.getRecipeTimeout(), parameterObject.getRequestAction(), + parameterObject.getServiceInstanceId(), parameterObject.getCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(), + parameterObject.getServiceType(), parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(), parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(), parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd()); + + StringEntity input = new StringEntity(jsonReq); + input.setContentType(CommonConstants.CONTENT_TYPE_JSON); + + String encryptedCredentials = null; + if(props!=null){ + encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH); + if(encryptedCredentials != null){ + String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY); + if(userCredentials != null){ + post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); + } + } + } + + post.setEntity(input); + HttpResponse response = client.execute(post); + msoLogger.debug("Response is: " + response); + + return response; + } + + @Override + public HttpResponse get() { + return null; + } + + protected String wrapRequest(String reqXML, String requestId, String serviceInstanceId, String requestTimeout, String schemaVersion){ + String jsonReq = null; + + try{ + CamundaRequest camundaRequest = new CamundaRequest(); + CamundaInput camundaInput = new CamundaInput(); + CamundaInput host = new CamundaInput(); + CamundaInput schema = new CamundaInput(); + CamundaInput reqid = new CamundaInput(); + CamundaInput svcid = new CamundaInput(); + CamundaInput timeout = new CamundaInput(); + camundaInput.setValue(StringUtils.defaultString(reqXML)); + host.setValue(parseURL()); + schema.setValue(StringUtils.defaultString(schemaVersion)); + reqid.setValue(requestId); + svcid.setValue(serviceInstanceId); + timeout.setValue(StringUtils.defaultString(requestTimeout)); + camundaRequest.setServiceInput(camundaInput); + camundaRequest.setHost(host); + camundaRequest.setReqid(reqid); + camundaRequest.setSvcid(svcid); + camundaRequest.setSchema(schema); + camundaRequest.setTimeout(timeout); + ObjectMapper mapper = new ObjectMapper(); + + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + + jsonReq = mapper.writeValueAsString(camundaRequest); + msoLogger.trace("request body is " + jsonReq); + }catch(Exception e){ + msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", e); + } + return jsonReq; + } + + + protected String wrapVIDRequest(String requestId, boolean isBaseVfModule, + int recipeTimeout, String requestAction, String serviceInstanceId, String correlationId, + String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, + String serviceType, String vnfType, String vfModuleType, String networkType, + String requestDetails, String apiVersion, boolean aLaCarte, String requestUri, String paramXsd){ + String jsonReq = null; + + try{ + CamundaVIDRequest camundaRequest = new CamundaVIDRequest(); + CamundaInput serviceInput = new CamundaInput(); + CamundaInput host = new CamundaInput(); + CamundaInput requestIdInput= new CamundaInput(); + CamundaBooleanInput isBaseVfModuleInput = new CamundaBooleanInput(); + CamundaIntegerInput recipeTimeoutInput = new CamundaIntegerInput(); + CamundaInput requestActionInput = new CamundaInput(); + CamundaInput serviceInstanceIdInput = new CamundaInput(); + CamundaInput correlationIdInput = new CamundaInput(); + CamundaInput vnfIdInput = new CamundaInput(); + CamundaInput vfModuleIdInput = new CamundaInput(); + CamundaInput volumeGroupIdInput = new CamundaInput(); + CamundaInput networkIdInput = new CamundaInput(); + CamundaInput configurationIdInput = new CamundaInput(); + CamundaInput serviceTypeInput = new CamundaInput(); + CamundaInput vnfTypeInput = new CamundaInput(); + CamundaInput vfModuleTypeInput = new CamundaInput(); + CamundaInput networkTypeInput = new CamundaInput(); + CamundaBooleanInput aLaCarteInput = new CamundaBooleanInput(); + CamundaInput apiVersionInput = new CamundaInput(); + CamundaInput requestUriInput = new CamundaInput(); + CamundaInput recipeParamsInput = new CamundaInput(); + + //host.setValue(parseURL()); + requestIdInput.setValue(StringUtils.defaultString(requestId)); + isBaseVfModuleInput.setValue(isBaseVfModule); + recipeTimeoutInput.setValue(recipeTimeout); + requestActionInput.setValue(StringUtils.defaultString(requestAction)); + serviceInstanceIdInput.setValue(StringUtils.defaultString(serviceInstanceId)); + correlationIdInput.setValue(StringUtils.defaultString(correlationId)); + vnfIdInput.setValue(StringUtils.defaultString(vnfId)); + vfModuleIdInput.setValue(StringUtils.defaultString(vfModuleId)); + volumeGroupIdInput.setValue(StringUtils.defaultString(volumeGroupId)); + networkIdInput.setValue(StringUtils.defaultString(networkId)); + configurationIdInput.setValue(StringUtils.defaultString(configurationId)); + serviceTypeInput.setValue(StringUtils.defaultString(serviceType)); + vnfTypeInput.setValue(StringUtils.defaultString(vnfType)); + vfModuleTypeInput.setValue(StringUtils.defaultString(vfModuleType)); + networkTypeInput.setValue(StringUtils.defaultString(networkType)); + aLaCarteInput.setValue(aLaCarte); + apiVersionInput.setValue(StringUtils.defaultString(apiVersion)); + requestUriInput.setValue(StringUtils.defaultString(requestUri)); + recipeParamsInput.setValue(paramXsd); + + serviceInput.setValue(requestDetails); + camundaRequest.setServiceInput(serviceInput); + camundaRequest.setHost(host); + camundaRequest.setRequestId(requestIdInput); + camundaRequest.setMsoRequestId(requestIdInput); + camundaRequest.setIsBaseVfModule(isBaseVfModuleInput); + camundaRequest.setRecipeTimeout(recipeTimeoutInput); + camundaRequest.setRequestAction(requestActionInput); + camundaRequest.setServiceInstanceId(serviceInstanceIdInput); + camundaRequest.setCorrelationId(correlationIdInput); + camundaRequest.setVnfId(vnfIdInput); + camundaRequest.setVfModuleId(vfModuleIdInput); + camundaRequest.setVolumeGroupId(volumeGroupIdInput); + camundaRequest.setNetworkId(networkIdInput); + camundaRequest.setConfigurationId(configurationIdInput); + camundaRequest.setServiceType(serviceTypeInput); + camundaRequest.setVnfType(vnfTypeInput); + camundaRequest.setVfModuleType(vfModuleTypeInput); + camundaRequest.setNetworkType(networkTypeInput); + camundaRequest.setaLaCarte(aLaCarteInput); + camundaRequest.setApiVersion(apiVersionInput); + camundaRequest.setRequestUri(requestUriInput); + camundaRequest.setRecipeParams(recipeParamsInput); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + + jsonReq = mapper.writeValueAsString(camundaRequest); + msoLogger.trace("request body is " + jsonReq); + }catch(Exception e){ + msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", e); + } + return jsonReq; + } + + private String parseURL(){ + String[] parts = url.split(":"); + String host = ""; + if(parts.length>=2){ + host = parts[1]; + if(host.length()>2){ + host = host.substring(2); + } + } + return host; + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java new file mode 100644 index 0000000000..166a5c4d10 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.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.apihandler.common; + +import java.io.IOException; + +import javax.xml.bind.DatatypeConverter; + +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.onap.so.logger.MsoLogger; + +public class CamundaTaskClient extends RequestClient{ + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaTaskClient.class); + + public CamundaTaskClient() { + super(CommonConstants.CAMUNDATASK); + } + + @Override + public HttpResponse post(String jsonReq) throws IOException{ + HttpPost post = new HttpPost(url); + msoLogger.debug("Camunda Task url is: "+ url); + + StringEntity input = new StringEntity(jsonReq); + input.setContentType(CommonConstants.CONTENT_TYPE_JSON); + + String encryptedCredentials; + if(props!=null){ + encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH); + if(encryptedCredentials != null){ + String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY); + if(userCredentials != null){ + post.addHeader("Authorization", "Basic " + DatatypeConverter + .printBase64Binary(userCredentials.getBytes())); + } + } + } + + post.setEntity(input); + return client.execute(post); + } + + @Override + public HttpResponse post(String camundaReqXML, String requestId, + String requestTimeout, String schemaVersion, String serviceInstanceId, String action) { + throw new UnsupportedOperationException("Method not supported."); + } + + @Override + public HttpResponse post(RequestClientParameter params) { + throw new UnsupportedOperationException("Method not supported."); + } + + @Override + public HttpResponse get() throws IOException { + HttpGet get = new HttpGet(url); + msoLogger.debug("Camunda Task url is: "+ url); + String encryptedCredentials; + if(props!=null){ + encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH); + if(encryptedCredentials != null){ + String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY); + if(userCredentials != null){ + get.addHeader("Authorization", "Basic " + new String(DatatypeConverter + .printBase64Binary(userCredentials.getBytes()))); + } + } + } + return client.execute(get); + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java new file mode 100644 index 0000000000..d5540ddbaa --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java @@ -0,0 +1,88 @@ +/*- + * ============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.common; + + +public final class CommonConstants { + + public static final String DEFAULT_BPEL_AUTH = "admin:admin"; + public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + + public static final String REQUEST_ID_HEADER = "mso-request-id"; + public static final String REQUEST_TIMEOUT_HEADER = "mso-service-request-timeout"; + public static final String SCHEMA_VERSION_HEADER = "mso-schema-version"; + public static final String SERVICE_INSTANCE_ID_HEADER = "mso-service-instance-id"; + public static final String ACTION_HEADER = "mso-action"; + + public static final String G_REQUEST_ID = "mso-request-id"; + public static final String G_SERVICEINSTANCEID = "serviceInstanceId"; + public static final String G_ACTION = "gAction"; + + public static final String CAMUNDA_SERVICE_INPUT = "bpmnRequest"; + public static final String CAMUNDA_ROOT_INPUT = "variables"; + public static final String CONTENT_TYPE_JSON= "application/json"; + public static final String CAMUNDA_TYPE = "type"; + public static final String CAMUNDA_VALUE = "value"; + public static final String CAMUNDA_URL = "mso.camundaURL"; + public static final String CAMUNDA_AUTH = "mso.camundaAuth"; + public static final String BPEL_SEARCH_STR = "active-bpel"; + public static final String TASK_SEARCH_STR = "task"; + public static final String BPEL_URL = "bpelURL"; + public static final String BPEL_AUTH = "bpelAuth"; + public static final int BPEL = 0; + public static final int CAMUNDA = 1; + public static final int CAMUNDATASK = 2; + public static final String CAMUNDA_HOST = "host"; + public static final String REQUEST_ID_VARIABLE = "requestId"; + public static final String IS_BASE_VF_MODULE_VARIABLE = "isBaseVfModule"; + public static final String RECIPE_TIMEOUT_VARIABLE = "recipeTimeout"; + public static final String REQUEST_ACTION_VARIABLE = "requestAction"; + public static final String SERVICE_INSTANCE_ID_VARIABLE = "serviceInstanceId"; + public static final String CORRELATION_ID = "correlationId"; + public static final String VNF_ID_VARIABLE = "vnfId"; + public static final String VF_MODULE_ID_VARIABLE = "vfModuleId"; + public static final String VOLUME_GROUP_ID_VARIABLE = "volumeGroupId"; + public static final String NETWORK_ID_VARIABLE = "networkId"; + public static final String CONFIGURATION_ID_VARIABLE = "configurationId"; + public static final String SERVICE_TYPE_VARIABLE = "serviceType"; + public static final String VNF_TYPE_VARIABLE = "vnfType"; + public static final String VF_MODULE_TYPE_VARIABLE = "vfModuleType"; + public static final String NETWORK_TYPE_VARIABLE = "networkType"; + public static final String REQUEST_DETAILS_VARIABLE = "requestDetails"; + public static final String ALACARTE_ORCHESTRATION = "mso.infra.default.alacarte.orchestrationUri"; + public static final String ALACARTE_RECIPE_TIMEOUT = "mso.infra.default.alacarte.recipeTimeout"; + public static final String RECIPE_PARAMS = "recipeParams"; + public static final String ALACARTE_TEST_API = "mso.infra.default.alacarte.testApi"; + public static final String MACRO_TEST_API = "mso.infra.service.macro.default.testApi"; + public static final String ALACARTE = "aLaCarte"; + public static final String API_VERSION = "apiVersion"; + public static final String REQUEST_URI = "requestUri"; + public static final String API_MINOR_VERSION = "mso.infra.default.versions.apiMinorVersion"; + public static final String API_PATCH_VERSION = "mso.infra.default.versions.apiPatchVersion"; + public static final String X_TRANSACTION_ID = "X-TransactionID"; + public static final String X_MINOR_VERSION = "X-MinorVersion"; + public static final String X_PATCH_VERSION = "X-PatchVersion"; + public static final String X_LATEST_VERSION = "X-LatestVersion"; + + private CommonConstants () { + // prevent creating an instance of this class + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java new file mode 100644 index 0000000000..5d755b9529 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java @@ -0,0 +1,77 @@ +/*- + * ============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.common; + +public final class ErrorNumbers { + + private ErrorNumbers() { + } + + public static final String REQUEST_FAILED_SCHEMA_VALIDATION = "1000"; + public static final String RECIPE_DOES_NOT_EXIST = "1010"; + public static final String VFMODULE_TYPE_DOES_NOT_EXIST = "1011"; + public static final String REQUEST_DOES_NOT_EXIST = "1012"; + public static final String SERVICE_DOES_NOT_EXIST = "1013"; + public static final String SERVICE_PARAMETERS_FAILED_SCHEMA_VALIDATION = "1020"; + public static final String LOCKED_SAME_SERVICE_TYPE_AND_REQUEST_ACTION = "1030"; + public static final String LOCKED_CANCEL_ON_REQUEST_IN_PROGRESS = "1031"; + public static final String LOCKED_REQUEST_IN_PROGRESS_TIMEOUT = "1032"; + public static final String LOCKED_NOT_ALLOWED_FOR_REQUEST_IN_PROGRESS = "1033"; + public static final String WITHDRAW_AFTER_COMPLETE = "1034"; + public static final String COMPLETE_AFTER_WITHDRAW = "1035"; // NOT USED + public static final String REQUEST_PREVIOUSLY_COMPLETED = "1036"; + public static final String CANNOT_RETRY_FINAL_ACTIVATION = "1037"; + public static final String PREVIOUSLY_COMPLETED_WITH_DIFF_ORDER_VERSION = "1038"; + public static final String LOCKED_DIFFERENT_REQUEST_ACTION = "1040"; + public static final String LOCKED_DIFF_REQUEST_ACTION_SAME_SERVICE_INSTANCE_ID = "1041"; + public static final String LOCKED_DIFFERENT_REQUEST_SAME_VPN_ID = "1042"; + public static final String REQUEST_TIMED_OUT = "1050"; + + + public static final String DISCONNECT_ALREADY_COMPLETE = "1100"; + public static final String CANCEL_ALREADY_COMPLETE = "1110"; + + public static final String LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS = "1400"; + public static final String LOCKED_SAME_ACTION_AND_VNF_ID = "1410"; + + public static final String ERROR_FROM_BPEL = "2000"; + public static final String NO_COMMUNICATION_TO_BPEL = "2010"; + public static final String NO_RESPONSE_FROM_BPEL = "2020"; + + public static final String COULD_NOT_WRITE_TO_REQUESTS_DB = "4000"; + public static final String NO_COMMUNICATION_TO_REQUESTS_DB = "4010"; + public static final String NO_COMMUNICATION_TO_CATALOG_DB = "4020"; + public static final String ERROR_FROM_CATALOG_DB = "4030"; + + public static final String ERROR_FROM_SDNC = "5300"; + public static final String NO_COMMUNICATION_TO_SDNC = "5310"; + public static final String NO_RESPONSE_FROM_SDNC = "5320"; + + public static final String NO_COMMUNICATION_TO_SDNC_ADAPTER = "7000"; + public static final String NO_RESPONSE_FROM_SDNC_ADAPTER = "7010"; + public static final String ERROR_FROM_SDNC_ADAPTER = "7020"; + + public static final String SVC_GENERAL_SERVICE_ERROR = "SVC0001"; + public static final String SVC_BAD_PARAMETER = "SVC0002"; + public static final String SVC_NO_SERVER_RESOURCES = "SVC1000"; + public static final String SVC_DETAILED_SERVICE_ERROR = "SVC2000"; + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/LSInputImpl.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/LSInputImpl.java new file mode 100644 index 0000000000..60473fb8c4 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/LSInputImpl.java @@ -0,0 +1,119 @@ +/*- + * ============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.common; + + +import java.io.InputStream; +import java.io.Reader; + +import org.w3c.dom.ls.LSInput; + +public class LSInputImpl implements LSInput { + + protected String fPublicId; + protected String fSystemId; + protected String fBaseSystemId; + protected InputStream fByteStream; + protected Reader fCharStream; + protected String fData; + protected String fEncoding; + protected boolean fCertifiedText; + + @Override + public InputStream getByteStream () { + return fByteStream; + } + + @Override + public void setByteStream (InputStream byteStream) { + fByteStream = byteStream; + } + + @Override + public Reader getCharacterStream () { + return fCharStream; + } + + @Override + public void setCharacterStream (Reader characterStream) { + fCharStream = characterStream; + } + + @Override + public String getStringData () { + return fData; + } + + @Override + public void setStringData (String stringData) { + fData = stringData; + } + + @Override + public String getEncoding () { + return fEncoding; + } + + @Override + public void setEncoding (String encoding) { + fEncoding = encoding; + } + + @Override + public String getPublicId () { + return fPublicId; + } + + @Override + public void setPublicId (String publicId) { + fPublicId = publicId; + } + + @Override + public String getSystemId () { + return fSystemId; + } + + @Override + public void setSystemId (String systemId) { + fSystemId = systemId; + } + + @Override + public String getBaseURI () { + return fBaseSystemId; + } + + @Override + public void setBaseURI (String baseURI) { + fBaseSystemId = baseURI; + } + + @Override + public boolean getCertifiedText () { + return fCertifiedText; + } + + @Override + public void setCertifiedText (boolean certifiedText) { + fCertifiedText = certifiedText; + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java new file mode 100644 index 0000000000..4e37561891 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java @@ -0,0 +1,63 @@ +/*- + * ============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.common; + + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import org.onap.so.logger.MsoLogger; +import org.w3c.dom.ls.LSInput; +import org.w3c.dom.ls.LSResourceResolver; + +public class PathResourceResolver implements LSResourceResolver { + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, PathResourceResolver.class); + + private String path; + + public PathResourceResolver(String path) { + + this.path = path; + } + + @Override + public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { + + LSInputImpl input = new LSInputImpl(); + + InputStream stream = null; + try { + stream = new FileInputStream(path + systemId); + } catch (FileNotFoundException e) { + msoLogger.debug ("Could not resolve resource based on file: " + path + systemId, e); + } + + input.setPublicId(publicId); + input.setSystemId(systemId); + input.setBaseURI(baseURI); + input.setCharacterStream(new InputStreamReader(stream)); + + return input; + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java new file mode 100644 index 0000000000..ca1ad7a277 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java @@ -0,0 +1,102 @@ +/*- + * ============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.common; + +import java.io.IOException; +import java.security.GeneralSecurityException; + +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.HttpClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.CryptoUtils; +import org.springframework.core.env.Environment; + +public abstract class RequestClient { + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH,RequestClient.class); + protected Environment props; + protected String url; + protected HttpClient client; + private int type; + + public RequestClient(int type){ + this.type = type; + } + + public void setProps(Environment env) { + this.props = env; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUrl() { + return url; + } + + public int getType(){ + return type; + } + + public HttpClient getClient() { + return client; + } + + public void setClient(HttpClient client) { + this.client = client; + } + + public abstract HttpResponse post(String request, String requestId, String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws IOException; + + public abstract HttpResponse post(String request) throws ClientProtocolException, IOException; + + public abstract HttpResponse post(RequestClientParameter parameterObject) throws ClientProtocolException, IOException; + + public abstract HttpResponse get() + throws IOException; + + protected String decryptPropValue(String prop, String defaultValue, String encryptionKey) { + try { + String result = CryptoUtils.decrypt(prop, encryptionKey); + return result; + } + catch (GeneralSecurityException e) { + msoLogger.debug("Security exception", e); + } + return defaultValue; + } + + protected String getEncryptedPropValue (String prop, String defaultValue, String encryptionKey) { + try { + String result = CryptoUtils.decrypt(prop, encryptionKey); + return result; + } + catch (GeneralSecurityException e) { + msoLogger.debug("Security exception", e); + } + return defaultValue; + } + + + + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java new file mode 100644 index 0000000000..e94f186c60 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.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.apihandler.common; + + + + +import org.apache.http.impl.client.DefaultHttpClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +public class RequestClientFactory { + + @Autowired + private Environment env; + + //based on URI, returns BPEL, CamundaTask or Camunda client + public RequestClient getRequestClient(String orchestrationURI) throws IllegalStateException{ + RequestClient retClient; + + String url; + if(orchestrationURI.contains(CommonConstants.TASK_SEARCH_STR)){ + url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI; + retClient = new CamundaTaskClient(); + } + else{ + url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI; + retClient = new CamundaClient(); + } + retClient.setClient(new DefaultHttpClient()); + retClient.setProps(env); + retClient.setUrl(url); + return retClient; + + } + + public Environment getEnv() { + return env; + } + + public void setEnv(Environment env) { + this.env = env; + } + + + + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java new file mode 100644 index 0000000000..89db934985 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java @@ -0,0 +1,279 @@ +/*- + * ============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.apihandler.common; + +public class RequestClientParameter { + + private String requestId; + private boolean isBaseVfModule; + private int recipeTimeout; + private String requestAction; + private String serviceInstanceId; + private String correlationId; + private String vnfId; + private String vfModuleId; + private String volumeGroupId; + private String networkId; + private String configurationId; + private String serviceType; + private String vnfType; + private String vfModuleType; + private String networkType; + private String requestDetails; + private String apiVersion; + private boolean aLaCarte; + private String recipeParamXsd; + private String requestUri; + + private RequestClientParameter(Builder builder) { + requestId = builder.requestId; + isBaseVfModule = builder.isBaseVfModule; + recipeTimeout = builder.recipeTimeout; + requestAction = builder.requestAction; + serviceInstanceId = builder.serviceInstanceId; + correlationId = builder.correlationId; + vnfId = builder.vnfId; + vfModuleId = builder.vfModuleId; + volumeGroupId = builder.volumeGroupId; + networkId = builder.networkId; + configurationId = builder.configurationId; + serviceType = builder.serviceType; + vnfType = builder.vnfType; + vfModuleType = builder.vfModuleType; + networkType = builder.networkType; + requestDetails = builder.requestDetails; + recipeParamXsd = builder.recipeParamXsd; + apiVersion = builder.apiVersion; + aLaCarte = builder.aLaCarte; + requestUri = builder.requestUri; + + } + + public String getRequestId() { + return requestId; + } + + public boolean isBaseVfModule() { + return isBaseVfModule; + } + + public int getRecipeTimeout() { + return recipeTimeout; + } + + public String getRequestAction() { + return requestAction; + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public String getCorrelationId() { + return correlationId; + } + + public String getVnfId() { + return vnfId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public String getNetworkId() { + return networkId; + } + + public String getConfigurationId() { + return configurationId; + } + + public String getServiceType() { + return serviceType; + } + + public String getVnfType() { + return vnfType; + } + + public String getVfModuleType() { + return vfModuleType; + } + + public String getNetworkType() { + return networkType; + } + + public String getRequestDetails() { + return requestDetails; + } + + public String getRecipeParamXsd() { + return recipeParamXsd; + } + + public String getApiVersion() { + return apiVersion; + } + + public boolean isaLaCarte() { + return aLaCarte; + } + + public String getRequestUri() { + return requestUri; + } + + public static class Builder { + private String requestId; + private boolean isBaseVfModule = false; + private int recipeTimeout; + private String requestAction; + private String serviceInstanceId; + private String correlationId; + private String vnfId; + private String vfModuleId; + private String volumeGroupId; + private String networkId; + private String configurationId; + private String serviceType; + private String vnfType; + private String vfModuleType; + private String networkType; + private String requestDetails; + private String apiVersion; + private boolean aLaCarte = false; + private String recipeParamXsd; + private String requestUri; + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public Builder setBaseVfModule(boolean baseVfModule) { + isBaseVfModule = baseVfModule; + return this; + } + + public Builder setRecipeTimeout(int recipeTimeout) { + this.recipeTimeout = recipeTimeout; + return this; + } + + public Builder setRequestAction(String requestAction) { + this.requestAction = requestAction; + return this; + } + + public Builder setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + return this; + } + + public Builder setCorrelationId(String correlationId) { + this.correlationId = correlationId; + return this; + } + + public Builder setVnfId(String vnfId) { + this.vnfId = vnfId; + return this; + } + + public Builder setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + return this; + } + + public Builder setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + return this; + } + + public Builder setNetworkId(String networkId) { + this.networkId = networkId; + return this; + } + + public Builder setConfigurationId(String configurationId) { + this.configurationId = configurationId; + return this; + } + + public Builder setServiceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + public Builder setVnfType(String vnfType) { + this.vnfType = vnfType; + return this; + } + + public Builder setVfModuleType(String vfModuleType) { + this.vfModuleType = vfModuleType; + return this; + } + + public Builder setNetworkType(String networkType) { + this.networkType = networkType; + return this; + } + + public Builder setRequestDetails(String requestDetails) { + this.requestDetails = requestDetails; + return this; + } + + public Builder setRecipeParamXsd(String recipeParamXsd) { + this.recipeParamXsd = recipeParamXsd; + return this; + } + + public Builder setApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + return this; + } + + public Builder setALaCarte(boolean aLaCarte) { + this.aLaCarte = aLaCarte; + return this; + } + + public Builder setRequestUri(String requestUri) { + this.requestUri = requestUri; + return this; + } + + public RequestClientParameter build(){ + return new RequestClientParameter(this); + } + } + + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java new file mode 100644 index 0000000000..fc6da3fa7d --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java @@ -0,0 +1,221 @@ +/*- + * ============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.common; + + +import java.io.IOException; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.util.EntityUtils; +import org.onap.so.apihandler.camundabeans.CamundaResponse; +import org.onap.so.apihandlerinfra.Constants; +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.ErrorLoggerInfo; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class ResponseHandler { + + private CamundaResponse response; + private int status; + private String responseBody=""; + private HttpResponse httpResponse; + private int type; + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ResponseHandler.class); + + public ResponseHandler(HttpResponse httpResponse, int type) throws ApiException{ + this.httpResponse = httpResponse; + this.type=type; + parseResponse(); + } + + + private void parseResponse() throws ApiException{ + int statusCode = httpResponse.getStatusLine().getStatusCode(); + status = setStatus(statusCode); + if(type==CommonConstants.CAMUNDA){ + parseCamunda(); + }else if(type==CommonConstants.CAMUNDATASK){ + parseCamundaTask(); + }else { + parseBpel(); + } + + } + + + + private void parseCamunda() throws ApiException{ + try{ + HttpEntity entity = httpResponse.getEntity(); + responseBody = EntityUtils.toString(entity); + } catch (IOException e) { + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + + + ValidateException validateException = new ValidateException.Builder("IOException getting Camunda response body", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) + .errorInfo(errorLoggerInfo).build(); + throw validateException; + } + + ObjectMapper mapper = new ObjectMapper(); + try { + response = mapper.readValue(responseBody, CamundaResponse.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("JSON Object Mapping Request", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) + .errorInfo(errorLoggerInfo).build(); + throw validateException; + } + if(response!=null){ + responseBody = response.getResponse(); + }else{ + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError) + .targetEntity("Camunda").targetServiceName("parseCamunda").build(); + BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL) + .errorInfo(errorLoggerInfo).build(); + } + } + + private void parseBpel() throws ApiException{ + + HttpEntity bpelEntity = httpResponse.getEntity(); + + try { + if (bpelEntity != null) { + responseBody = EntityUtils.toString(bpelEntity); + + } + }catch(IOException e){ + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build(); + ValidateException validateException = new ValidateException.Builder("Could not convert BPEL response to string", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) + .errorInfo(errorLoggerInfo).build(); + throw validateException; + } + if(status!=HttpStatus.SC_ACCEPTED){ + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError) + .targetEntity("BPEL").targetServiceName("parseBpel").build(); + + + BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL) + .errorInfo(errorLoggerInfo).build(); + + throw bpmnFailureException; + } + + } + + private void parseCamundaTask() throws ApiException{ + + HttpEntity camundataskEntity = httpResponse.getEntity(); + + try { + if (camundataskEntity != null) { + responseBody = EntityUtils.toString(camundataskEntity); + } + }catch(IOException e) { + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build(); + + + ValidateException validateException = new ValidateException.Builder("Could not convert CamundaTask response to string", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) + .errorInfo(errorLoggerInfo).build(); + throw validateException; + } + if(status!=HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED){ + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError) + .targetEntity("CAMUNDATASK").targetServiceName("parseCamundaTask").build(); + + + BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL) + .errorInfo(errorLoggerInfo).build(); + + throw bpmnFailureException; + } + + } + + private int setStatus(int statusCode){ + int httpStatus; + switch(statusCode) { + case HttpStatus.SC_ACCEPTED: + case HttpStatus.SC_OK: + httpStatus = HttpStatus.SC_ACCEPTED; + break; + case HttpStatus.SC_BAD_REQUEST: + httpStatus = HttpStatus.SC_BAD_REQUEST; + break; + case HttpStatus.SC_UNAUTHORIZED: + case HttpStatus.SC_FORBIDDEN: + httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR; + break; + case HttpStatus.SC_NOT_FOUND: + httpStatus = HttpStatus.SC_NOT_IMPLEMENTED; + break; + case HttpStatus.SC_INTERNAL_SERVER_ERROR: + httpStatus = HttpStatus.SC_BAD_GATEWAY; + break; + case HttpStatus.SC_SERVICE_UNAVAILABLE: + httpStatus = HttpStatus.SC_SERVICE_UNAVAILABLE; + break; + case HttpStatus.SC_NO_CONTENT: + httpStatus = HttpStatus.SC_NO_CONTENT; + break; + default: + httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR; + break; + } + return httpStatus; + } + + + public CamundaResponse getResponse() { + return response; + } + + + public void setResponse(CamundaResponse response) { + this.response = response; + } + + + public String getResponseBody() { + return responseBody; + } + + + public void setResponseBody(String responseBody) { + this.responseBody = responseBody; + } + + + public int getStatus() { + return status; + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java new file mode 100644 index 0000000000..3c72e479c7 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.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.apihandler.common; + + +import java.io.FileInputStream; +import java.io.IOException; + +import javax.xml.XMLConstants; +import javax.xml.transform.Source; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import javax.xml.validation.Validator; + +import org.apache.commons.io.IOUtils; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; +import org.xml.sax.SAXException; + +public class XMLValidator { + + private static String XSDS_PATH; + + static { + String prefixMsoPropertiesPath = System.getProperty ("mso.config.path"); + if (prefixMsoPropertiesPath == null) { + prefixMsoPropertiesPath = ""; + } + XSDS_PATH = prefixMsoPropertiesPath + "xsds/"; + } + + private String stringXsd; + private String errorMsg = null; + private SchemaFactory factory; + private Schema schema; + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, XMLValidator.class); + private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + + public XMLValidator (String xsdFile){ + + try (FileInputStream xsdStream = new FileInputStream (XSDS_PATH + xsdFile)) { + + stringXsd = IOUtils.toString (xsdStream); + + factory = SchemaFactory.newInstance (XMLConstants.W3C_XML_SCHEMA_NS_URI); + factory.setResourceResolver (new PathResourceResolver (XSDS_PATH)); + factory.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true); + + String quotedXsd = stringXsd.replaceAll (""", "\""); + Source src = new StreamSource (new java.io.StringReader (quotedXsd)); + schema = factory.newSchema (src); + + } catch (IOException | SAXException e) { + + msoLogger.debug ("Cannot open file " + XSDS_PATH + xsdFile, e); + errorMsg = "ErrorDetails: xsd file " + xsdFile + "could not be opened - " + e.getMessage (); + } + } + + // Returns null when XML valid, otherwise returns error details. + public String isXmlValid (String stringXml) { + try { + if (errorMsg != null && !errorMsg.isEmpty ()) { + return errorMsg; + } + Source src2 = new StreamSource (new java.io.StringReader (stringXml)); + Validator validator = schema.newValidator (); + validator.validate (src2); + + } catch (IOException | SAXException e) { + msoLogger.debug ("Exception: ", e); + return "ErrorDetails: " + e.getMessage (); + + } catch (Exception e) { + msoLogger.error (MessageEnum.APIH_CANNOT_READ_SCHEMA, "", "", MsoLogger.ErrorCode.SchemaError, "APIH cannot read schema file", e); + alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, "Unable to read the schema file"); + return "ErrorDetails: " + "Unable to read the schema file"; + } + + return null; + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java b/mso-api-handlers/mso-api-handler-common/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-common/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-common/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java new file mode 100644 index 0000000000..e920db2fd2 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.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; + +/* + * Enum for Status values returned by API Handler to Tail-F +*/ +public enum Action { + createInstance, + updateInstance, + deleteInstance, + configureInstance, + replaceInstance, + activateInstance, + deactivateInstance, + enablePort, + disablePort, + addRelationships, + removeRelationships, + inPlaceSoftwareUpdate, + applyUpdatedConfig, + completeTask, + assignInstance, + unassignInstance, + compareModel, + scaleInstance +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-common/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-common/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-common/src/main/java/org/onap/so/apihandlerinfra/Messages.java b/mso-api-handlers/mso-api-handler-common/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-common/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 errors = new HashMap<>(); + static { + errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_service", "Service request FAILED schema validation. %s"); + errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_feature", "Feature request FAILED schema validation. %s"); + errors.put(ErrorNumbers.RECIPE_DOES_NOT_EXIST, "Recipe for %s-type and action specified does not exist in catalog %s"); + errors.put(ErrorNumbers.SERVICE_PARAMETERS_FAILED_SCHEMA_VALIDATION, "Service specific parameters passed in request FAILED schema validation. %s"); + + errors.put(ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS, "%s-name (%s) is locked (status = %s) because already working on a CREATE request with same %s-name."); + errors.put(ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID, "%s-id (%s) is locked (status = %s) because already working on a request with same action (%s) for this %s-id."); + errors.put(ErrorNumbers.REQUEST_TIMED_OUT, "Service request timed out before completing"); + errors.put(ErrorNumbers.ERROR_FROM_BPEL, "BPEL returned an error: %s"); + errors.put(ErrorNumbers.NO_COMMUNICATION_TO_BPEL, "Could not communicate with BPEL %s"); + errors.put(ErrorNumbers.NO_RESPONSE_FROM_BPEL, "No response from BPEL %s"); + errors.put(ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, "Could not insert or update record in MSO_REQUESTS DB %s"); + errors.put(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, "Could not communicate with MSO_REQUESTS DB %s"); + errors.put(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB, "Could not communicate with MSO_CATALOG DB %s"); + errors.put(ErrorNumbers.ERROR_FROM_CATALOG_DB, "Received error from MSO_CATALOG DB %s"); + } + + private Messages(){ + } + + public static Map getErrors() { + return errors; + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java b/mso-api-handlers/mso-api-handler-common/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-common/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-common/src/main/java/org/onap/so/apihandlerinfra/MsoException.java b/mso-api-handlers/mso-api-handler-common/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-common/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-common/src/main/java/org/onap/so/apihandlerinfra/Status.java b/mso-api-handlers/mso-api-handler-common/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-common/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-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java new file mode 100644 index 0000000000..dc52bfcc6b --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java @@ -0,0 +1,125 @@ +/*- + * ============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.exceptions; + + +import java.util.List; + +import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo; +import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; + +public abstract class ApiException extends Exception{ + /** + * + */ + private static final long serialVersionUID = 683162058616691134L; + private int httpResponseCode; + private String messageID; + private ErrorLoggerInfo errorLoggerInfo; + private AlarmLoggerInfo alarmLoggerInfo; + private List variables; + + public ApiException(Builder builder){ + super(builder.message, builder.cause); + + this.httpResponseCode = builder.httpResponseCode; + this.messageID = builder.messageID; + this.variables = builder.variables; + this.errorLoggerInfo = builder.errorLoggerInfo; + this.alarmLoggerInfo = builder.alarmLoggerInfo; + this.variables = builder.variables; + } + + public ApiException(String message, Throwable cause) { + super(message, cause); + } + + public String getMessageID() { + return messageID; + } + + public int getHttpResponseCode() { + return httpResponseCode; + } + + public ErrorLoggerInfo getErrorLoggerInfo() { + return errorLoggerInfo; + } + + public AlarmLoggerInfo getAlarmLoggerInfo() { + return alarmLoggerInfo; + } + + public List getVariables() { + return variables; + } + + public static class Builder> { + private String message; + private Throwable cause = null; + private int httpResponseCode; + private String messageID; + private ErrorLoggerInfo errorLoggerInfo = null; + private AlarmLoggerInfo alarmLoggerInfo = null; + private List variables = null; + + public Builder(String message, int httpResponseCode, String messageID) { + this.message = message; + this.httpResponseCode = httpResponseCode; + this.messageID = messageID; + } + + public T message(String message) { + this.message = message; + return (T) this; + } + + public T cause(Throwable cause) { + this.cause = cause; + return (T) this; + } + + public T httpResponseCode(int httpResponseCode) { + this.httpResponseCode = httpResponseCode; + return (T) this; + } + + public T messageID(String messageID) { + this.messageID = messageID; + return (T) this; + } + + public T errorInfo(ErrorLoggerInfo errorLoggerInfo){ + this.errorLoggerInfo = errorLoggerInfo; + return (T) this; + } + + public T alarmInfo(AlarmLoggerInfo alarmLoggerInfo){ + this.alarmLoggerInfo = alarmLoggerInfo; + return (T) this; + } + + public T variables(List variables) { + this.variables = variables; + return (T) this; + } + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java new file mode 100644 index 0000000000..e0bcc71736 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java @@ -0,0 +1,111 @@ +/*- + * ============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.exceptions; + +import java.util.List; + +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; +import javax.ws.rs.ext.Provider; + +import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo; +import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.RequestError; +import org.onap.so.serviceinstancebeans.ServiceException; + + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +@Provider +public class ApiExceptionMapper implements ExceptionMapper { + + private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ApiExceptionMapper.class); + private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + @Override + public Response toResponse(ApiException exception) { + + return Response.status(exception.getHttpResponseCode()).entity(buildErrorString(exception)).build(); + } + + protected String buildErrorString(ApiException exception) { + String errorText = exception.getMessage(); + String messageId = exception.getMessageID(); + List variables = exception.getVariables(); + ErrorLoggerInfo errorLoggerInfo = exception.getErrorLoggerInfo(); + AlarmLoggerInfo alarmLoggerInfo = exception.getAlarmLoggerInfo(); + + + if (errorText.length() > 1999) { + errorText = errorText.substring(0, 1999); + } + + writeErrorLog(errorText, errorLoggerInfo, alarmLoggerInfo); + + return buildServiceErrorResponse(errorText,messageId,variables); + + } + + protected String buildServiceErrorResponse(String errorText, String messageId, List variables){ + RequestError re = new RequestError(); + 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; + + ObjectMapper mapper = createObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT); + try { + requestErrorStr = mapper.writeValueAsString(re); + } catch (JsonProcessingException e) { + String errorMsg = "Exception in buildServiceErrorResponse writing exceptionType to string " + e.getMessage(); + logger.error(MessageEnum.GENERAL_EXCEPTION, "BuildServiceErrorResponse", "", "", MsoLogger.ErrorCode.DataError, errorMsg, e); + return errorMsg; + } + + return requestErrorStr; + } + + protected void writeErrorLog(String errorText, ErrorLoggerInfo errorLogInfo, AlarmLoggerInfo alarmLogInfo) { + + if(errorLogInfo != null) + logger.error(errorLogInfo.getLoggerMessageType().toString(), errorLogInfo.getErrorSource(), errorLogInfo.getTargetEntity(), errorLogInfo.getTargetServiceName(), errorLogInfo.getErrorCode(), errorText); + if(alarmLogInfo != null){ + alarmLogger.sendAlarm(alarmLogInfo.getAlarm(),alarmLogInfo.getState(),alarmLogInfo.getDetail()); + } + } + + public ObjectMapper createObjectMapper(){ + return new ObjectMapper(); + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/BPMNFailureException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/BPMNFailureException.java new file mode 100644 index 0000000000..8c215de213 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/BPMNFailureException.java @@ -0,0 +1,43 @@ +/*- + * ============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.exceptions; + +public class BPMNFailureException extends ApiException { + + private static final String bpmnFailMessage = "Request Failed due to BPEL error with HTTP Status = $HTTPSTATUS"; + + private BPMNFailureException(Builder builder) { + super(builder); + } + + public static class Builder extends ApiException.Builder{ + + + public Builder(String message, int httpResponseCode, String messageID) { + super(bpmnFailMessage.replaceAll ("\\$HTTPSTATUS", message),httpResponseCode,messageID); + } + + public BPMNFailureException build() { + return new BPMNFailureException(this); + } + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ClientConnectionException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ClientConnectionException.java new file mode 100644 index 0000000000..cf4c9168ea --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ClientConnectionException.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.exceptions; + +public class ClientConnectionException extends ApiException { + + /** + * + */ + private static final long serialVersionUID = 1L; + private static final String clientFailMessage = "Client from $URL failed to connect"; + + private ClientConnectionException(Builder builder) { + super(builder); + } + + public static class Builder extends ApiException.Builder{ + + public Builder(String message, int httpResponseCode, String messageID) { + super(clientFailMessage.replaceAll ("\\$URL", message),httpResponseCode,messageID); + } + + public ClientConnectionException build() { + return new ClientConnectionException(this); + } + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java new file mode 100644 index 0000000000..718dc6421d --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java @@ -0,0 +1,47 @@ +/*- + * ============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.exceptions; + +public class DuplicateRequestException extends ApiException { + + private static final String duplicateFailMessage = "Error: Locked instance - This %s (%s) " + "already has a request being worked with a status of %s (RequestId - %s). The existing request must finish or be cleaned up before proceeding."; + + private DuplicateRequestException(Builder builder) { + super(builder); + } + + + public static class Builder extends ApiException.Builder{ + + + public Builder(String requestScope,String instance, String requestStatus, String requestID, int httpResponseCode, String messageID) { + super(String.format(duplicateFailMessage,requestScope,instance,requestStatus,requestID),httpResponseCode,messageID); + + } + + + public DuplicateRequestException build() { + + return new DuplicateRequestException(this); + } + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RecipeNotFoundException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RecipeNotFoundException.java new file mode 100644 index 0000000000..620103be4e --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RecipeNotFoundException.java @@ -0,0 +1,43 @@ +/*- + * ============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.exceptions; + + +public class RecipeNotFoundException extends ApiException { + + private RecipeNotFoundException(Builder builder) { + super(builder); + } + + public static class Builder extends ApiException.Builder { + + + public Builder(String message, int httpResponseCode, String messageID) { + super(message, httpResponseCode, messageID); + } + + public RecipeNotFoundException build() { + + return new RecipeNotFoundException(this); + } + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java new file mode 100644 index 0000000000..b0cf39e1a2 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java @@ -0,0 +1,43 @@ +/*- + * ============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.exceptions; + +public class ValidateException extends ApiException { + + + private ValidateException(Builder builder) { + super(builder); + } + + + public static class Builder extends ApiException.Builder{ + + public Builder(String message, int httpResponseCode, String messageID) { + super(message,httpResponseCode,messageID); + } + + public ValidateException build() { + + return new ValidateException(this); + } + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/VfModuleNotFoundException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/VfModuleNotFoundException.java new file mode 100644 index 0000000000..d80f2f7b48 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/VfModuleNotFoundException.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.exceptions; + +public class VfModuleNotFoundException extends ApiException { + + + /** + * + */ + private static final long serialVersionUID = 1L; + + private VfModuleNotFoundException(Builder builder) { + super(builder); + } + + public static class Builder extends ApiException.Builder{ + + public Builder(String message, int httpResponseCode, String messageID) { + super(message,httpResponseCode,messageID); + } + public VfModuleNotFoundException build() { + + return new VfModuleNotFoundException(this); + } + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/AlarmLoggerInfo.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/AlarmLoggerInfo.java new file mode 100644 index 0000000000..2746da4f2d --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/AlarmLoggerInfo.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.logging; + +import java.io.Serializable; + +public class AlarmLoggerInfo implements Serializable{ + /** + * + */ + private static final long serialVersionUID = -6730979289437576112L; + private String alarm; + private int state; + private String detail; + + + private AlarmLoggerInfo(String alarm, int state, String detail){ + this.alarm = alarm; + this.state = state; + this.detail = detail; + } + + public int getState() { + return state; + } + + public String getAlarm() { + return alarm; + } + + public String getDetail() { + return detail; + } + + public static class Builder{ + private String alarm = ""; + private int state; + private String detail = ""; + + public Builder(String alarm, int state, String detail){ + this.alarm = alarm; + this.state = state; + this.detail = detail; + } + + public Builder alarm(String alarm){ + this.alarm = alarm; + return this; + } + + public Builder state(int state){ + this.state = state; + return this; + } + + public Builder detail(String detail){ + this.detail = detail; + return this; + } + + public AlarmLoggerInfo build(){ + return new AlarmLoggerInfo(alarm, state, detail); + } + + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java new file mode 100644 index 0000000000..b0b154bc5c --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java @@ -0,0 +1,111 @@ +/*- + * ============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.logging; + +import java.io.Serializable; + +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger.ErrorCode; + + + +public class ErrorLoggerInfo implements Serializable{ + /** + * + */ + private static final long serialVersionUID = -2917784544098682110L; + private MessageEnum loggerMessageType; + private String errorSource; + private String targetEntity; + private String targetServiceName; + private ErrorCode errorCode; + + private ErrorLoggerInfo(MessageEnum loggerMessageType, String errorSource, String targetEntity, String targetServiceName, ErrorCode errorCode){ + this.loggerMessageType = loggerMessageType; + this.errorSource = errorSource; + this.targetEntity = targetEntity; + this.targetServiceName = targetServiceName; + this.errorCode = errorCode; + } + + public MessageEnum getLoggerMessageType() { + return loggerMessageType; + } + + public String getErrorSource() { + return errorSource; + } + + public String getTargetEntity() { + return targetEntity; + } + + public String getTargetServiceName() { + return targetServiceName; + } + + public ErrorCode getErrorCode() { + return errorCode; + } + + public static class Builder{ + private MessageEnum loggerMessageType; + private String errorSource = ""; + private String targetEntity = ""; + private String targetServiceName = ""; + private ErrorCode errorCode; + + public Builder(MessageEnum loggerMessageType, ErrorCode errorCode){ + this.loggerMessageType = loggerMessageType; + this.errorCode = errorCode; + } + + public Builder loggerMessageType(MessageEnum loggerMessageType){ + this.loggerMessageType = loggerMessageType; + return this; + } + + public Builder errorSource(String errorSource){ + this.errorSource = errorSource; + return this; + } + + public Builder targetEntity(String targetEntity){ + this.targetEntity = targetEntity; + return this; + } + + public Builder targetServiceName(String targetServiceName){ + this.targetServiceName = targetServiceName; + return this; + } + + public Builder errorCode(ErrorCode errorCode){ + this.errorCode = errorCode; + return this; + } + + public ErrorLoggerInfo build(){ + return new ErrorLoggerInfo(loggerMessageType, errorSource, targetEntity, targetServiceName, errorCode); + } + + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java deleted file mode 100644 index e4db35bcca..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java +++ /dev/null @@ -1,252 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.camundabeans; - -import org.openecomp.mso.apihandler.common.CommonConstants; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; - -/** - * JavaBean JSON class for a "bpmnRequest" which contains the JSON payload that - * will be passed to the Camunda process - */ -@JsonPropertyOrder({CommonConstants.REQUEST_ID_VARIABLE, - CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE, - CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_ID_VARIABLE, - CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE, - CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE, - CommonConstants.SERVICE_TYPE_VARIABLE, CommonConstants.VNF_TYPE_VARIABLE, - CommonConstants.VF_MODULE_TYPE_VARIABLE, CommonConstants.NETWORK_TYPE_VARIABLE, - CommonConstants.REQUEST_DETAILS_VARIABLE}) -@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT) -public class BpmnRequest { - - @JsonProperty(CommonConstants.CAMUNDA_HOST) - private CamundaInput host; - - @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE) - private CamundaInput requestId; - - @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) - private CamundaBooleanInput isBaseVfModule; - - @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE) - private CamundaIntegerInput recipeTimeout; - - @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE) - private CamundaInput requestAction; - - @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) - private CamundaInput serviceInstanceId; - - @JsonProperty(CommonConstants.VNF_ID_VARIABLE) - private CamundaInput vnfId; - - @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE) - private CamundaInput vfModuleId; - - @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE) - private CamundaInput volumeGroupId; - - @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE) - private CamundaInput networkId; - - @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE) - private CamundaInput serviceType; - - @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE) - private CamundaInput vnfType; - - @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE) - private CamundaInput vfModuleType; - - @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE) - private CamundaInput networkType; - - @JsonProperty(CommonConstants.REQUEST_DETAILS_VARIABLE) - private CamundaInput requestDetails; - - public BpmnRequest() { - /* Empty constructor */ - - } - - @JsonProperty(CommonConstants.CAMUNDA_HOST) - public CamundaInput getHost() { - return host; - } - - @JsonProperty(CommonConstants.CAMUNDA_HOST) - public void setHost(CamundaInput host) { - this.host = host; - } - - @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE) - public CamundaInput getRequestId() { - return requestId; - } - - @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE) - public void setRequestId(CamundaInput requestId) { - this.requestId = requestId; - } - - @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) - public CamundaBooleanInput getIsBaseVfModule() { - return isBaseVfModule; - } - - @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) - public void setIsBaseVfModule(CamundaBooleanInput isBaseVfModule) { - this.isBaseVfModule = isBaseVfModule; - } - - @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE) - public CamundaIntegerInput getRecipeTimeout() { - return recipeTimeout; - } - - @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE) - public void setRecipeTimeout(CamundaIntegerInput recipeTimeout) { - this.recipeTimeout = recipeTimeout; - } - - @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE) - public CamundaInput getRequestAction() { - return requestAction; - } - - @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE) - public void setRequestAction(CamundaInput requestAction) { - this.requestAction = requestAction; - } - @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) - public CamundaInput getServiceInstanceId() { - return serviceInstanceId; - } - - @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) - public void setServiceInstanceId(CamundaInput serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - @JsonProperty(CommonConstants.VNF_ID_VARIABLE) - public CamundaInput getVnfId() { - return vnfId; - } - - @JsonProperty(CommonConstants.VNF_ID_VARIABLE) - public void setVnfId(CamundaInput vnfId) { - this.vnfId = vnfId; - } - - @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE) - public CamundaInput getVfModuleId() { - return vfModuleId; - } - - @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE) - public void setVfModuleId(CamundaInput vfModuleId) { - this.vfModuleId = vfModuleId; - } - - @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE) - public CamundaInput getVolumeGroupId() { - return volumeGroupId; - } - - @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE) - public void setVolumeGroupId(CamundaInput volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - - @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE) - public CamundaInput getNetworkId() { - return networkId; - } - - @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE) - public void setNetworkId(CamundaInput networkId) { - this.networkId = networkId; - } - - @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE) - public CamundaInput getServiceType() { - return serviceType; - } - - @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE) - public void setServiceType(CamundaInput serviceType) { - this.serviceType = serviceType; - } - - @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE) - public CamundaInput getVnfType() { - return vnfType; - } - - @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE) - public void setVnfType(CamundaInput vnfType) { - this.vnfType = vnfType; - } - - @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE) - public CamundaInput getVfModuleType() { - return vfModuleType; - } - - @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE) - public void setVfModuleType(CamundaInput vfModuleType) { - this.vfModuleType = vfModuleType; - } - - @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE) - public CamundaInput getNetworkType() { - return networkType; - } - - @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE) - public void setNetworkType(CamundaInput networkType) { - this.networkType = networkType; - } - - @JsonProperty(CommonConstants.REQUEST_DETAILS_VARIABLE) - public CamundaInput getRequestDetails() { - return requestDetails; - } - - @JsonProperty(CommonConstants.REQUEST_DETAILS_VARIABLE) - public void setRequestDetails(CamundaInput requestDetails) { - this.requestDetails = requestDetails; - } - - - - - @Override - public String toString() { - - return "BpmnRequest"; - } - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBooleanInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBooleanInput.java deleted file mode 100644 index 07b72f0678..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBooleanInput.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.camundabeans; - -import org.openecomp.mso.apihandler.common.CommonConstants; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that - * will be passed to the Camunda process - */ - - -public class CamundaBooleanInput { - - @JsonProperty(CommonConstants.CAMUNDA_VALUE) - private boolean value; - @JsonProperty(CommonConstants.CAMUNDA_TYPE) - private final String type = "Boolean"; - - - public CamundaBooleanInput() { - } - - @JsonProperty(CommonConstants.CAMUNDA_VALUE) - public boolean getValue() { - return value; - } - - @JsonProperty(CommonConstants.CAMUNDA_VALUE) - public void setValue(boolean value) { - this.value = value; - } - - @Override - public String toString() { - return "CamundaInput [value=" + value + ", type=" + type + "]"; - } - - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java deleted file mode 100644 index e93e6c1c15..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.camundabeans; - -import org.openecomp.mso.apihandler.common.CommonConstants; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that - * will be passed to the Camunda process - */ -public class CamundaBpmnRequestInput { - - @JsonProperty(CommonConstants.CAMUNDA_VALUE) - private BpmnRequest value; - @JsonProperty(CommonConstants.CAMUNDA_TYPE) - private final String type = "String"; - - - public CamundaBpmnRequestInput() { - /* Empty constructor */ - } - - @JsonProperty(CommonConstants.CAMUNDA_VALUE) - public BpmnRequest getValue() { - return value; - } - - @JsonProperty(CommonConstants.CAMUNDA_VALUE) - public void setValue(BpmnRequest value) { - this.value = value; - } - - @Override - public String toString() { - return "CamundaInput [value=" + value + ", type=" + type + "]"; - } - - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java deleted file mode 100644 index 07a3fa4a76..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.camundabeans; - - -import org.openecomp.mso.apihandler.common.CommonConstants; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that - * will be passed to the Camunda process - * - */ - - -public class CamundaInput { - - @JsonProperty(CommonConstants.CAMUNDA_VALUE) - private String value; - @JsonProperty(CommonConstants.CAMUNDA_TYPE) - private final String type = "String"; - - - public CamundaInput() { - /* Empty constructor */ - } - - @JsonProperty(CommonConstants.CAMUNDA_VALUE) - public String getValue() { - return value; - } - - @JsonProperty(CommonConstants.CAMUNDA_VALUE) - public void setValue(String value) { - this.value = value; - } - - @Override - public String toString() { - return "CamundaInput [value=" + value + ", type=" + type + "]"; - } - - - - - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaIntegerInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaIntegerInput.java deleted file mode 100644 index 9a1bbca77a..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaIntegerInput.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.camundabeans; - -import org.openecomp.mso.apihandler.common.CommonConstants; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * JavaBean JSON class for a "gMyServiceInput" which contains the xml payload that - * will be passed to the Camunda process - */ -public class CamundaIntegerInput { - - @JsonProperty(CommonConstants.CAMUNDA_VALUE) - private int value; - @JsonProperty(CommonConstants.CAMUNDA_TYPE) - private final String type = "Integer"; - - - public CamundaIntegerInput() { - } - - @JsonProperty(CommonConstants.CAMUNDA_VALUE) - public int getValue() { - return value; - } - - @JsonProperty(CommonConstants.CAMUNDA_VALUE) - public void setValue(int value) { - this.value = value; - } - - @Override - public String toString() { - return "CamundaInput [value=" + Integer.toString(value) + ", type=" + type + "]"; - } - - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaRequest.java deleted file mode 100644 index 60a9efe9b6..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaRequest.java +++ /dev/null @@ -1,133 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.camundabeans; - - - -import org.openecomp.mso.apihandler.common.CommonConstants; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; - -/** - * JavaBean JSON class for a "variables" which contains the xml payload that - * will be passed to the Camunda process - * - */ -@JsonPropertyOrder({ CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.CAMUNDA_HOST, - CommonConstants.SCHEMA_VERSION_HEADER, CommonConstants.REQUEST_ID_HEADER, CommonConstants.SERVICE_INSTANCE_ID_HEADER, - CommonConstants. REQUEST_TIMEOUT_HEADER, CommonConstants.CAMUNDA_SERVICE_INPUT}) -@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT) -public class CamundaRequest { - - @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) - private CamundaInput serviceInput; - - @JsonProperty(CommonConstants.CAMUNDA_HOST) - private CamundaInput host; - - @JsonProperty(CommonConstants.SCHEMA_VERSION_HEADER) - private CamundaInput schema; - - @JsonProperty(CommonConstants.REQUEST_ID_HEADER) - private CamundaInput reqid; - - @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_HEADER) - private CamundaInput svcid; - - @JsonProperty(CommonConstants.REQUEST_TIMEOUT_HEADER) - private CamundaInput timeout; - - public CamundaRequest() { - } - - @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) - public CamundaInput getServiceInput() { - return serviceInput; - } - - @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) - public void setServiceInput(CamundaInput serviceInput) { - this.serviceInput = serviceInput; - } - - @JsonProperty(CommonConstants.CAMUNDA_HOST) - public CamundaInput getHost() { - return host; - } - - @JsonProperty(CommonConstants.CAMUNDA_HOST) - public void setHost(CamundaInput host) { - this.host = host; - } - - @JsonProperty(CommonConstants.SCHEMA_VERSION_HEADER) - public CamundaInput getSchema() { - return schema; - } - - @JsonProperty(CommonConstants.SCHEMA_VERSION_HEADER) - public void setSchema(CamundaInput schema) { - this.schema = schema; - } - - @JsonProperty(CommonConstants.REQUEST_ID_HEADER) - public CamundaInput getReqid() { - return reqid; - } - - @JsonProperty(CommonConstants.REQUEST_ID_HEADER) - public void setReqid(CamundaInput reqid) { - this.reqid = reqid; - } - - @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_HEADER) - public CamundaInput getSvcid() { - return svcid; - } - - @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_HEADER) - public void setSvcid(CamundaInput svcid) { - this.svcid = svcid; - } - - - @JsonProperty(CommonConstants.REQUEST_TIMEOUT_HEADER) - public CamundaInput getTimeout() { - return timeout; - } - - @JsonProperty(CommonConstants.REQUEST_TIMEOUT_HEADER) - public void setTimeout(CamundaInput timeout) { - this.timeout = timeout; - } - - - - @Override - public String toString() { - return "CamundaRequest [serviceInput=" + serviceInput + ", host=" - + host + ", schema=" + schema + ", reqid=" + reqid + ", svcid=" - + svcid + ", timeout=" + timeout + "]"; - } - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java deleted file mode 100644 index 64b7d86b59..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.camundabeans; - -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -// This class must be 100% JSON-compatible with the BPMN WorkflowResponse class. -// TODO: BPMN and the API-H should use a common class. - -/** - * A synchronous response from a workflow. - */ -@JsonRootName(value = "WorkflowResponse") -public class CamundaResponse { - - @JsonProperty("processInstanceId") - private String processInstanceId; - - @JsonProperty("messageCode") - private int messageCode; - - @JsonProperty("message") - private String message; - - @JsonProperty("variables") - private Map variables; - - @JsonProperty("content") - private String content; - - public String getProcessInstanceId() { - return processInstanceId; - } - - public void setProcessInstanceId(String processInstanceId) { - this.processInstanceId = processInstanceId; - } - - public int getMessageCode() { - return messageCode; - } - - public void setMessageCode(int messageCode) { - this.messageCode = messageCode; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public Map getVariables() { - return variables; - } - - public void setVariables(Map variables) { - this.variables = variables; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - @Override - public String toString() { - return getClass().getSimpleName() + "[" - + "processInstanceId=" + processInstanceId - + ",messageCode=" + messageCode - + ",message=" + message - + ",variables=" + variables - + ",content=" + content - + "]"; - } -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java deleted file mode 100644 index 9f30e67897..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java +++ /dev/null @@ -1,300 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.camundabeans; - -import org.openecomp.mso.apihandler.common.CommonConstants; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; - -/** - * JavaBean JSON class for a "variables" which contains the JSON payload that - * will be passed to the Camunda process - */ -@JsonPropertyOrder({CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.REQUEST_ID_VARIABLE, - CommonConstants.REQUEST_ID_HEADER, - CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE, - CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_ID_VARIABLE, - CommonConstants.CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE, - CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE, - CommonConstants.CONFIGURATION_ID_VARIABLE, CommonConstants.SERVICE_TYPE_VARIABLE, - CommonConstants.VNF_TYPE_VARIABLE, CommonConstants.VF_MODULE_TYPE_VARIABLE, - CommonConstants.NETWORK_TYPE_VARIABLE, CommonConstants.CAMUNDA_SERVICE_INPUT, - CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.RECIPE_PARAMS}) -@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT) -public class CamundaVIDRequest { - - @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) - private CamundaInput serviceInput; - - @JsonProperty(CommonConstants.CAMUNDA_HOST) - private CamundaInput host; - - @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE) - private CamundaInput requestId; - - @JsonProperty(CommonConstants.REQUEST_ID_HEADER) - private CamundaInput msoRequestId; - - @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) - private CamundaBooleanInput isBaseVfModule; - - @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE) - private CamundaIntegerInput recipeTimeout; - - @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE) - private CamundaInput requestAction; - - @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) - private CamundaInput serviceInstanceId; - - @JsonProperty(CommonConstants.CORRELATION_ID) - private CamundaInput correlationId; - - @JsonProperty(CommonConstants.VNF_ID_VARIABLE) - private CamundaInput vnfId; - - @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE) - private CamundaInput vfModuleId; - - @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE) - private CamundaInput volumeGroupId; - - @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE) - private CamundaInput networkId; - - @JsonProperty(CommonConstants.CONFIGURATION_ID_VARIABLE) - private CamundaInput configurationId; - - @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE) - private CamundaInput serviceType; - - @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE) - private CamundaInput vnfType; - - @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE) - private CamundaInput vfModuleType; - - @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE) - private CamundaInput networkType; - - @JsonProperty(CommonConstants.RECIPE_PARAMS) - private CamundaInput recipeParams; - - @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) - public CamundaInput getServiceInput() { - return serviceInput; - } - - @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) - public void setServiceInput(CamundaInput serviceInput) { - this.serviceInput = serviceInput; - } - - @JsonProperty(CommonConstants.CAMUNDA_HOST) - public CamundaInput getHost() { - return host; - } - - @JsonProperty(CommonConstants.CAMUNDA_HOST) - public void setHost(CamundaInput host) { - this.host = host; - } - - @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE) - public CamundaInput getRequestId() { - return requestId; - } - - @JsonProperty(CommonConstants.REQUEST_ID_VARIABLE) - public void setRequestId(CamundaInput requestId) { - this.requestId = requestId; - } - - @JsonProperty(CommonConstants.REQUEST_ID_HEADER) - public CamundaInput getMsoRequestId() { - return msoRequestId; - } - - @JsonProperty(CommonConstants.REQUEST_ID_HEADER) - public void setMsoRequestId(CamundaInput msoRequestIdp) { - this.msoRequestId = msoRequestIdp; - } - - @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) - public CamundaBooleanInput getIsBaseVfModule() { - return isBaseVfModule; - } - - @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) - public void setIsBaseVfModule(CamundaBooleanInput isBaseVfModule) { - this.isBaseVfModule = isBaseVfModule; - } - - @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE) - public CamundaIntegerInput getRecipeTimeout() { - return recipeTimeout; - } - - @JsonProperty(CommonConstants.RECIPE_TIMEOUT_VARIABLE) - public void setRecipeTimeout(CamundaIntegerInput recipeTimeout) { - this.recipeTimeout = recipeTimeout; - } - - @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE) - public CamundaInput getRequestAction() { - return requestAction; - } - - @JsonProperty(CommonConstants.REQUEST_ACTION_VARIABLE) - public void setRequestAction(CamundaInput requestAction) { - this.requestAction = requestAction; - } - @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) - public CamundaInput getServiceInstanceId() { - return serviceInstanceId; - } - - @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) - public void setServiceInstanceId(CamundaInput serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - @JsonProperty(CommonConstants.CORRELATION_ID) - public CamundaInput getCorrelationId() { - return correlationId; - } - - @JsonProperty(CommonConstants.CORRELATION_ID) - public void setCorrelationId(CamundaInput correlationId) { - this.correlationId = correlationId; - } - - @JsonProperty(CommonConstants.VNF_ID_VARIABLE) - public CamundaInput getVnfId() { - return vnfId; - } - - @JsonProperty(CommonConstants.VNF_ID_VARIABLE) - public void setVnfId(CamundaInput vnfId) { - this.vnfId = vnfId; - } - - @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE) - public CamundaInput getVfModuleId() { - return vfModuleId; - } - - @JsonProperty(CommonConstants.VF_MODULE_ID_VARIABLE) - public void setVfModuleId(CamundaInput vfModuleId) { - this.vfModuleId = vfModuleId; - } - - @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE) - public CamundaInput getVolumeGroupId() { - return volumeGroupId; - } - - @JsonProperty(CommonConstants.VOLUME_GROUP_ID_VARIABLE) - public void setVolumeGroupId(CamundaInput volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - - @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE) - public CamundaInput getNetworkId() { - return networkId; - } - - @JsonProperty(CommonConstants.NETWORK_ID_VARIABLE) - public void setNetworkId(CamundaInput networkId) { - this.networkId = networkId; - } - - @JsonProperty(CommonConstants.CONFIGURATION_ID_VARIABLE) - public CamundaInput getConfigurationId() { - return configurationId; - } - - @JsonProperty(CommonConstants.CONFIGURATION_ID_VARIABLE) - public void setConfigurationId(CamundaInput configurationId) { - this.configurationId = configurationId; - } - - @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE) - public CamundaInput getServiceType() { - return serviceType; - } - - @JsonProperty(CommonConstants.SERVICE_TYPE_VARIABLE) - public void setServiceType(CamundaInput serviceType) { - this.serviceType = serviceType; - } - - @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE) - public CamundaInput getVnfType() { - return vnfType; - } - - @JsonProperty(CommonConstants.VNF_TYPE_VARIABLE) - public void setVnfType(CamundaInput vnfType) { - this.vnfType = vnfType; - } - - @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE) - public CamundaInput getVfModuleType() { - return vfModuleType; - } - - @JsonProperty(CommonConstants.VF_MODULE_TYPE_VARIABLE) - public void setVfModuleType(CamundaInput vfModuleType) { - this.vfModuleType = vfModuleType; - } - - @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE) - public CamundaInput getNetworkType() { - return networkType; - } - - @JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE) - public void setNetworkType(CamundaInput networkType) { - this.networkType = networkType; - } - - @JsonProperty(CommonConstants.RECIPE_PARAMS) - public CamundaInput getRecipeParams() { - return recipeParams; - } - - @JsonProperty(CommonConstants.RECIPE_PARAMS) - public void setRecipeParams(CamundaInput recipeParams) { - this.recipeParams = recipeParams; - } - - @Override - public String toString() { - //return "CamundaRequest [requestId=" + + ", host=" - // + host + ", schema=" + schema + ", reqid=" + reqid + ", svcid=" - // + svcid + ", timeout=" + timeout + "]"; - return "CamundaRequest"; - } - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/Track.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/Track.java deleted file mode 100644 index e1928ebc76..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/Track.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.camundabeans; - -public class Track { - - String title; - String singer; - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getSinger() { - return singer; - } - - public void setSinger(String singer) { - this.singer = singer; - } - - @Override - public String toString() { - return "Track [title=" + title + ", singer=" + singer + "]"; - } - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java deleted file mode 100644 index 85fe52f24c..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - -import java.io.IOException; - -import javax.ws.rs.core.MediaType; -import javax.xml.bind.DatatypeConverter; - -import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; - -import org.openecomp.mso.logger.MsoLogger; - -public class BPELRestClient extends RequestClient { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - - public BPELRestClient () { - super (CommonConstants.BPEL); - } - - @Override - public HttpResponse post (String bpelReqXML, - String requestId, - String requestTimeout, - String schemaVersion, - String serviceInstanceId, - String action) throws ClientProtocolException, IOException { - String encryptedCredentials; - HttpPost post = new HttpPost (url); - msoLogger.debug ("BPEL url is: " + url); - StringEntity input = new StringEntity (bpelReqXML); - input.setContentType (MediaType.TEXT_XML); - if (props != null) { - encryptedCredentials = props.getProperty (CommonConstants.BPEL_AUTH,null); - if (encryptedCredentials != null) { - String userCredentials = getEncryptedPropValue (encryptedCredentials, - CommonConstants.DEFAULT_BPEL_AUTH, - CommonConstants.ENCRYPTION_KEY); - if (userCredentials != null) { - post.addHeader ("Authorization", - "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ())); - } - } - } - post.addHeader (CommonConstants.REQUEST_ID_HEADER, requestId); - post.addHeader (CommonConstants.REQUEST_TIMEOUT_HEADER, requestTimeout); - post.addHeader (CommonConstants.SCHEMA_VERSION_HEADER, schemaVersion); - if (serviceInstanceId != null) { - post.addHeader (CommonConstants.SERVICE_INSTANCE_ID_HEADER, serviceInstanceId); - } - if (action != null) { - post.addHeader (CommonConstants.ACTION_HEADER, action); - } - post.setEntity (input); - HttpResponse response = client.execute (post); - msoLogger.debug ("bpel response " + response); - return response; - } - - @Override - public HttpResponse post (String bpelReqXML) { - return null; - } - - @Override - public HttpResponse post(RequestClientParamater params) { - return null; - } - - @Override - public HttpResponse get() { - return null; - } -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java deleted file mode 100644 index c0cfdf9bec..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java +++ /dev/null @@ -1,254 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - -import java.io.IOException; - -import javax.xml.bind.DatatypeConverter; - -import org.apache.commons.lang3.StringUtils; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.openecomp.mso.apihandler.camundabeans.CamundaBooleanInput; -import org.openecomp.mso.apihandler.camundabeans.CamundaInput; -import org.openecomp.mso.apihandler.camundabeans.CamundaIntegerInput; -import org.openecomp.mso.apihandler.camundabeans.CamundaRequest; -import org.openecomp.mso.apihandler.camundabeans.CamundaVIDRequest; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -public class CamundaClient extends RequestClient{ - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - private static final String CAMUNDA_URL_MESAGE = "Camunda url is: "; - - public CamundaClient() { - super(CommonConstants.CAMUNDA); - } - - - @Override - public HttpResponse post(String camundaReqXML, String requestId, - String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws IOException { - HttpPost post = new HttpPost(url); - msoLogger.debug(CAMUNDA_URL_MESAGE + url); - String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion); - - StringEntity input = new StringEntity(jsonReq); - input.setContentType(CommonConstants.CONTENT_TYPE_JSON); - - String encryptedCredentials; - if(props!=null){ - encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null); - if(encryptedCredentials != null){ - String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY); - if(userCredentials != null){ - post.addHeader("Authorization", "Basic " + DatatypeConverter - .printBase64Binary(userCredentials.getBytes())); - } - } - } - - post.setEntity(input); - return client.execute(post); - } - - @Override - public HttpResponse post(String jsonReq) throws IOException { - HttpPost post = new HttpPost(url); - msoLogger.debug(CAMUNDA_URL_MESAGE + url); - - StringEntity input = new StringEntity(jsonReq); - input.setContentType(CommonConstants.CONTENT_TYPE_JSON); - - String encryptedCredentials; - if(props!=null){ - encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null); - if(encryptedCredentials != null){ - String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY); - if(userCredentials != null){ - post.addHeader("Authorization", "Basic " + DatatypeConverter - .printBase64Binary(userCredentials.getBytes())); - } - } - } - - post.setEntity(input); - - return client.execute(post); - } - - @Override - public HttpResponse post(RequestClientParamater params) throws IOException { - HttpPost post = new HttpPost(url); - msoLogger.debug(CAMUNDA_URL_MESAGE + url); - String jsonReq = wrapVIDRequest(params); - - StringEntity input = new StringEntity(jsonReq); - input.setContentType(CommonConstants.CONTENT_TYPE_JSON); - String encryptedCredentials; - if(props!=null){ - encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null); - if(encryptedCredentials != null){ - String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY); - if(userCredentials != null){ - post.addHeader("Authorization", "Basic " + DatatypeConverter - .printBase64Binary(userCredentials.getBytes())); - } - } - } - post.setEntity(input); - return client.execute(post); - } - - @Override - public HttpResponse get() { - return null; - } - - private String wrapRequest(String reqXML, String requestId, String serviceInstanceId, String requestTimeout, String schemaVersion){ - String jsonReq = null; - if(reqXML == null){ - reqXML =""; - } - if(requestTimeout == null){ - requestTimeout =""; - } - if(schemaVersion == null){ - schemaVersion = ""; - } - try{ - CamundaRequest camundaRequest = new CamundaRequest(); - CamundaInput camundaInput = new CamundaInput(); - CamundaInput host = new CamundaInput(); - CamundaInput schema = new CamundaInput(); - CamundaInput reqid = new CamundaInput(); - CamundaInput svcid = new CamundaInput(); - CamundaInput timeout = new CamundaInput(); - camundaInput.setValue(reqXML); - host.setValue(parseURL()); - schema.setValue(schemaVersion); - reqid.setValue(requestId); - svcid.setValue(serviceInstanceId); - timeout.setValue(requestTimeout); - camundaRequest.setServiceInput(camundaInput); - camundaRequest.setHost(host); - camundaRequest.setReqid(reqid); - camundaRequest.setSvcid(svcid); - camundaRequest.setSchema(schema); - camundaRequest.setTimeout(timeout); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - - jsonReq = mapper.writeValueAsString(camundaRequest); - msoLogger.debug("request body is " + jsonReq); - }catch(Exception e){ - msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", e); - } - return jsonReq; - } - - private String wrapVIDRequest(RequestClientParamater requestClientParamater) { - String jsonReq = null; - try{ - CamundaVIDRequest camundaRequest = new CamundaVIDRequest(); - CamundaInput serviceInput = new CamundaInput(); - CamundaInput host = new CamundaInput(); - CamundaInput requestIdInput= new CamundaInput(); - CamundaBooleanInput isBaseVfModuleInput = new CamundaBooleanInput(); - CamundaIntegerInput recipeTimeoutInput = new CamundaIntegerInput(); - CamundaInput requestActionInput = new CamundaInput(); - CamundaInput serviceInstanceIdInput = new CamundaInput(); - CamundaInput correlationIdInput = new CamundaInput(); - CamundaInput vnfIdInput = new CamundaInput(); - CamundaInput vfModuleIdInput = new CamundaInput(); - CamundaInput volumeGroupIdInput = new CamundaInput(); - CamundaInput networkIdInput = new CamundaInput(); - CamundaInput configurationIdInput = new CamundaInput(); - CamundaInput serviceTypeInput = new CamundaInput(); - CamundaInput vnfTypeInput = new CamundaInput(); - CamundaInput vfModuleTypeInput = new CamundaInput(); - CamundaInput networkTypeInput = new CamundaInput(); - CamundaInput recipeParamsInput = new CamundaInput(); - host.setValue(parseURL()); - requestIdInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestId())); - isBaseVfModuleInput.setValue(requestClientParamater.isBaseVfModule()); - recipeTimeoutInput.setValue(requestClientParamater.getRecipeTimeout()); - requestActionInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestAction())); - serviceInstanceIdInput.setValue(StringUtils.defaultString(requestClientParamater.getServiceInstanceId())); - correlationIdInput.setValue(StringUtils.defaultString(requestClientParamater.getCorrelationId())); - vnfIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVnfId())); - vfModuleIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVfModuleId())); - volumeGroupIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVolumeGroupId())); - networkIdInput.setValue(StringUtils.defaultString(requestClientParamater.getNetworkId())); - configurationIdInput.setValue(StringUtils.defaultString(requestClientParamater.getConfigurationId())); - serviceTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getServiceType())); - vnfTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getVnfType())); - vfModuleTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getVfModuleType())); - networkTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getNetworkType())); - recipeParamsInput.setValue(requestClientParamater.getRecipeParamXsd()); - serviceInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestDetails())); - camundaRequest.setServiceInput(serviceInput); - camundaRequest.setHost(host); - camundaRequest.setRequestId(requestIdInput); - camundaRequest.setMsoRequestId(requestIdInput); - camundaRequest.setIsBaseVfModule(isBaseVfModuleInput); - camundaRequest.setRecipeTimeout(recipeTimeoutInput); - camundaRequest.setRequestAction(requestActionInput); - camundaRequest.setServiceInstanceId(serviceInstanceIdInput); - camundaRequest.setCorrelationId(correlationIdInput); - camundaRequest.setVnfId(vnfIdInput); - camundaRequest.setVfModuleId(vfModuleIdInput); - camundaRequest.setVolumeGroupId(volumeGroupIdInput); - camundaRequest.setNetworkId(networkIdInput); - camundaRequest.setConfigurationId(configurationIdInput); - camundaRequest.setServiceType(serviceTypeInput); - camundaRequest.setVnfType(vnfTypeInput); - camundaRequest.setVfModuleType(vfModuleTypeInput); - camundaRequest.setNetworkType(networkTypeInput); - camundaRequest.setRecipeParams(recipeParamsInput); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - - jsonReq = mapper.writeValueAsString(camundaRequest); - msoLogger.debug("request body is " + jsonReq); - }catch(Exception e){ - msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", e); - } - return jsonReq; - } - - private String parseURL(){ - String[] parts = url.split(":"); - String host = ""; - if(parts.length>=2){ - host = parts[1]; - if(host.length()>2){ - host = host.substring(2); - } - } - return host; - } - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java deleted file mode 100644 index cbbbff3dff..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - -import java.io.IOException; - -import javax.xml.bind.DatatypeConverter; - -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.openecomp.mso.logger.MsoLogger; - -public class CamundaTaskClient extends RequestClient{ - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - - public CamundaTaskClient() { - super(CommonConstants.CAMUNDATASK); - } - - @Override - public HttpResponse post(String jsonReq) throws IOException{ - HttpPost post = new HttpPost(url); - msoLogger.debug("Camunda Task url is: "+ url); - - StringEntity input = new StringEntity(jsonReq); - input.setContentType(CommonConstants.CONTENT_TYPE_JSON); - - String encryptedCredentials; - if(props!=null){ - encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null); - if(encryptedCredentials != null){ - String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY); - if(userCredentials != null){ - post.addHeader("Authorization", "Basic " + DatatypeConverter - .printBase64Binary(userCredentials.getBytes())); - } - } - } - - post.setEntity(input); - return client.execute(post); - } - - @Override - public HttpResponse post(String camundaReqXML, String requestId, - String requestTimeout, String schemaVersion, String serviceInstanceId, String action) { - throw new UnsupportedOperationException("Method not supported."); - } - - @Override - public HttpResponse post(RequestClientParamater params) { - throw new UnsupportedOperationException("Method not supported."); - } - - @Override - public HttpResponse get() throws IOException { - HttpGet get = new HttpGet(url); - msoLogger.debug("Camunda Task url is: "+ url); - String encryptedCredentials; - if(props!=null){ - encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null); - if(encryptedCredentials != null){ - String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY); - if(userCredentials != null){ - get.addHeader("Authorization", "Basic " + new String(DatatypeConverter - .printBase64Binary(userCredentials.getBytes()))); - } - } - } - return client.execute(get); - } - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java deleted file mode 100644 index daa411a963..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - - -public final class CommonConstants { - - public static final String DEFAULT_BPEL_AUTH = "admin:admin"; - public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; - public static final String REQUEST_ID_HEADER = "mso-request-id"; - public static final String REQUEST_TIMEOUT_HEADER = "mso-service-request-timeout"; - public static final String SCHEMA_VERSION_HEADER = "mso-schema-version"; - public static final String SERVICE_INSTANCE_ID_HEADER = "mso-service-instance-id"; - public static final String ACTION_HEADER = "mso-action"; - public static final String CAMUNDA_SERVICE_INPUT = "bpmnRequest"; - public static final String CAMUNDA_ROOT_INPUT = "variables"; - public static final String CONTENT_TYPE_JSON= "application/json"; - public static final String CAMUNDA_TYPE = "type"; - public static final String CAMUNDA_VALUE = "value"; - public static final String CAMUNDA_URL = "camundaURL"; - public static final String CAMUNDA_AUTH = "camundaAuth"; - public static final String BPEL_SEARCH_STR = "active-bpel"; - public static final String TASK_SEARCH_STR = "task"; - public static final String BPEL_URL = "bpelURL"; - public static final String BPEL_AUTH = "bpelAuth"; - public static final int BPEL = 0; - public static final int CAMUNDA = 1; - public static final int CAMUNDATASK = 2; - public static final String CAMUNDA_HOST = "host"; - public static final String REQUEST_ID_VARIABLE = "requestId"; - public static final String IS_BASE_VF_MODULE_VARIABLE = "isBaseVfModule"; - public static final String RECIPE_TIMEOUT_VARIABLE = "recipeTimeout"; - public static final String REQUEST_ACTION_VARIABLE = "requestAction"; - public static final String SERVICE_INSTANCE_ID_VARIABLE = "serviceInstanceId"; - public static final String CORRELATION_ID = "correlationId"; - public static final String VNF_ID_VARIABLE = "vnfId"; - public static final String VF_MODULE_ID_VARIABLE = "vfModuleId"; - public static final String VOLUME_GROUP_ID_VARIABLE = "volumeGroupId"; - public static final String NETWORK_ID_VARIABLE = "networkId"; - public static final String CONFIGURATION_ID_VARIABLE = "configurationId"; - public static final String SERVICE_TYPE_VARIABLE = "serviceType"; - public static final String VNF_TYPE_VARIABLE = "vnfType"; - public static final String VF_MODULE_TYPE_VARIABLE = "vfModuleType"; - public static final String NETWORK_TYPE_VARIABLE = "networkType"; - public static final String REQUEST_DETAILS_VARIABLE = "requestDetails"; - public static final String ALACARTE_ORCHESTRATION = "mso.infra.default.alacarte.orchestrationUri"; - public static final String ALACARTE_RECIPE_TIMEOUT = "mso.infra.default.alacarte.recipeTimeout"; - public static final String RECIPE_PARAMS = "recipeParams"; - - private CommonConstants () { - // prevent creating an instance of this class - } -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ErrorNumbers.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ErrorNumbers.java deleted file mode 100644 index 2cafef3253..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ErrorNumbers.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - -public final class ErrorNumbers { - - private ErrorNumbers() { - } - - public static final String REQUEST_FAILED_SCHEMA_VALIDATION = "1000"; - public static final String RECIPE_DOES_NOT_EXIST = "1010"; - public static final String VFMODULE_TYPE_DOES_NOT_EXIST = "1011"; - public static final String SERVICE_PARAMETERS_FAILED_SCHEMA_VALIDATION = "1020"; - public static final String LOCKED_SAME_SERVICE_TYPE_AND_REQUEST_ACTION = "1030"; - public static final String LOCKED_CANCEL_ON_REQUEST_IN_PROGRESS = "1031"; - public static final String LOCKED_REQUEST_IN_PROGRESS_TIMEOUT = "1032"; - public static final String LOCKED_NOT_ALLOWED_FOR_REQUEST_IN_PROGRESS = "1033"; - public static final String WITHDRAW_AFTER_COMPLETE = "1034"; - public static final String COMPLETE_AFTER_WITHDRAW = "1035"; // NOT USED - public static final String REQUEST_PREVIOUSLY_COMPLETED = "1036"; - public static final String CANNOT_RETRY_FINAL_ACTIVATION = "1037"; - public static final String PREVIOUSLY_COMPLETED_WITH_DIFF_ORDER_VERSION = "1038"; - public static final String LOCKED_DIFFERENT_REQUEST_ACTION = "1040"; - public static final String LOCKED_DIFF_REQUEST_ACTION_SAME_SERVICE_INSTANCE_ID = "1041"; - public static final String REQUEST_TIMED_OUT = "1050"; - - public static final String DISCONNECT_ALREADY_COMPLETE = "1100"; - public static final String CANCEL_ALREADY_COMPLETE = "1110"; - - public static final String LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS = "1400"; - public static final String LOCKED_SAME_ACTION_AND_VNF_ID = "1410"; - - public static final String ERROR_FROM_BPEL = "2000"; - public static final String NO_COMMUNICATION_TO_BPEL = "2010"; - public static final String NO_RESPONSE_FROM_BPEL = "2020"; - - public static final String COULD_NOT_WRITE_TO_REQUESTS_DB = "4000"; - public static final String NO_COMMUNICATION_TO_REQUESTS_DB = "4010"; - public static final String NO_COMMUNICATION_TO_CATALOG_DB = "4020"; - public static final String ERROR_FROM_CATALOG_DB = "4030"; - - public static final String ERROR_FROM_SDNC = "5300"; - public static final String NO_COMMUNICATION_TO_SDNC = "5310"; - public static final String NO_RESPONSE_FROM_SDNC = "5320"; - - public static final String NO_COMMUNICATION_TO_SDNC_ADAPTER = "7000"; - public static final String NO_RESPONSE_FROM_SDNC_ADAPTER = "7010"; - public static final String ERROR_FROM_SDNC_ADAPTER = "7020"; - - public static final String SVC_GENERAL_SERVICE_ERROR = "SVC0001"; - public static final String SVC_BAD_PARAMETER = "SVC0002"; - public static final String SVC_NO_SERVER_RESOURCES = "SVC1000"; - public static final String SVC_DETAILED_SERVICE_ERROR = "SVC2000"; - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/LSInputImpl.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/LSInputImpl.java deleted file mode 100644 index b39b5347ee..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/LSInputImpl.java +++ /dev/null @@ -1,119 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - - -import java.io.InputStream; -import java.io.Reader; - -import org.w3c.dom.ls.LSInput; - -public class LSInputImpl implements LSInput { - - protected String fPublicId; - protected String fSystemId; - protected String fBaseSystemId; - protected InputStream fByteStream; - protected Reader fCharStream; - protected String fData; - protected String fEncoding; - protected boolean fCertifiedText; - - @Override - public InputStream getByteStream () { - return fByteStream; - } - - @Override - public void setByteStream (InputStream byteStream) { - fByteStream = byteStream; - } - - @Override - public Reader getCharacterStream () { - return fCharStream; - } - - @Override - public void setCharacterStream (Reader characterStream) { - fCharStream = characterStream; - } - - @Override - public String getStringData () { - return fData; - } - - @Override - public void setStringData (String stringData) { - fData = stringData; - } - - @Override - public String getEncoding () { - return fEncoding; - } - - @Override - public void setEncoding (String encoding) { - fEncoding = encoding; - } - - @Override - public String getPublicId () { - return fPublicId; - } - - @Override - public void setPublicId (String publicId) { - fPublicId = publicId; - } - - @Override - public String getSystemId () { - return fSystemId; - } - - @Override - public void setSystemId (String systemId) { - fSystemId = systemId; - } - - @Override - public String getBaseURI () { - return fBaseSystemId; - } - - @Override - public void setBaseURI (String baseURI) { - fBaseSystemId = baseURI; - } - - @Override - public boolean getCertifiedText () { - return fCertifiedText; - } - - @Override - public void setCertifiedText (boolean certifiedText) { - fCertifiedText = certifiedText; - } -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/PathResourceResolver.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/PathResourceResolver.java deleted file mode 100644 index c8c1ef08c9..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/PathResourceResolver.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.io.InputStreamReader; - -import org.w3c.dom.ls.LSInput; -import org.w3c.dom.ls.LSResourceResolver; - -import org.openecomp.mso.logger.MsoLogger; - -public class PathResourceResolver implements LSResourceResolver { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - - private String path; - - public PathResourceResolver(String path) { - - this.path = path; - } - - @Override - public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { - - LSInputImpl input = new LSInputImpl(); - - InputStream stream = null; - try { - stream = new FileInputStream(path + systemId); - } catch (FileNotFoundException e) { - msoLogger.debug ("Could not resolve resource based on file: " + path + systemId, e); - } - - input.setPublicId(publicId); - input.setSystemId(systemId); - input.setBaseURI(baseURI); - input.setCharacterStream(new InputStreamReader(stream)); - - return input; - } -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java deleted file mode 100644 index 66369a8b69..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - -import java.io.IOException; -import java.security.GeneralSecurityException; - -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.utils.CryptoUtils; - -public abstract class RequestClient { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - protected MsoJavaProperties props; - protected String url; - protected HttpClient client; - private int type; - - public RequestClient(int type){ - this.type = type; - } - - public void setProps(MsoJavaProperties props) { - this.props = props; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getUrl() { - return url; - } - - public int getType(){ - return type; - } - - public HttpClient getClient() { - return client; - } - - public void setClient(HttpClient client) { - this.client = client; - } - - public abstract HttpResponse post(String request, String requestId, String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws IOException; - - public abstract HttpResponse post(String request) throws IOException; - - public abstract HttpResponse post(RequestClientParamater params) throws IOException; - - public abstract HttpResponse get() throws IOException; - - protected String getEncryptedPropValue (String prop, String defaultValue, String encryptionKey) { - try { - return CryptoUtils.decrypt(prop, encryptionKey); - } - catch (GeneralSecurityException e) { - msoLogger.debug("Security exception", e); - } - return defaultValue; - } -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java deleted file mode 100644 index 8f919861dc..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - - -import org.apache.http.impl.client.DefaultHttpClient; - -import org.openecomp.mso.properties.MsoJavaProperties; - -public class RequestClientFactory { - - private RequestClientFactory() { - } - - //based on URI, returns BPEL, CamundaTask or Camunda client - public static RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{ - RequestClient retClient; - if(props ==null){ - throw new IllegalStateException("properties is null"); - } - String url; - if(orchestrationURI.contains(CommonConstants.BPEL_SEARCH_STR)){ - url = props.getProperty(CommonConstants.BPEL_URL,null) + orchestrationURI; - retClient= new BPELRestClient(); - - }else if(orchestrationURI.contains(CommonConstants.TASK_SEARCH_STR)){ - url = props.getProperty(CommonConstants.CAMUNDA_URL,null) + orchestrationURI; - retClient = new CamundaTaskClient(); - } - else{ - url = props.getProperty(CommonConstants.CAMUNDA_URL,null) + orchestrationURI; - retClient = new CamundaClient(); - } - retClient.setClient(new DefaultHttpClient()); - retClient.setProps(props); - retClient.setUrl(url); - return retClient; - - } - - - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java deleted file mode 100644 index 4db69199da..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java +++ /dev/null @@ -1,242 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - -public class RequestClientParamater { - - private String requestId; - private boolean isBaseVfModule; - private int recipeTimeout; - private String requestAction; - private String serviceInstanceId; - private String correlationId; - private String vnfId; - private String vfModuleId; - private String volumeGroupId; - private String networkId; - private String configurationId; - private String serviceType; - private String vnfType; - private String vfModuleType; - private String networkType; - private String requestDetails; - private String recipeParamXsd; - - private RequestClientParamater(Builder builder) { - requestId = builder.requestId; - isBaseVfModule = builder.isBaseVfModule; - recipeTimeout = builder.recipeTimeout; - requestAction = builder.requestAction; - serviceInstanceId = builder.serviceInstanceId; - correlationId = builder.correlationId; - vnfId = builder.vnfId; - vfModuleId = builder.vfModuleId; - volumeGroupId = builder.volumeGroupId; - networkId = builder.networkId; - configurationId = builder.configurationId; - serviceType = builder.serviceType; - vnfType = builder.vnfType; - vfModuleType = builder.vfModuleType; - networkType = builder.networkType; - requestDetails = builder.requestDetails; - recipeParamXsd = builder.recipeParamXsd; - } - - public String getRequestId() { - return requestId; - } - - public boolean isBaseVfModule() { - return isBaseVfModule; - } - - public int getRecipeTimeout() { - return recipeTimeout; - } - - public String getRequestAction() { - return requestAction; - } - - public String getServiceInstanceId() { - return serviceInstanceId; - } - - public String getCorrelationId() { - return correlationId; - } - - public String getVnfId() { - return vnfId; - } - - public String getVfModuleId() { - return vfModuleId; - } - - public String getVolumeGroupId() { - return volumeGroupId; - } - - public String getNetworkId() { - return networkId; - } - - public String getConfigurationId() { - return configurationId; - } - - public String getServiceType() { - return serviceType; - } - - public String getVnfType() { - return vnfType; - } - - public String getVfModuleType() { - return vfModuleType; - } - - public String getNetworkType() { - return networkType; - } - - public String getRequestDetails() { - return requestDetails; - } - - public String getRecipeParamXsd() { - return recipeParamXsd; - } - - public static class Builder { - private String requestId; - private boolean isBaseVfModule; - private int recipeTimeout; - private String requestAction; - private String serviceInstanceId; - private String correlationId; - private String vnfId; - private String vfModuleId; - private String volumeGroupId; - private String networkId; - private String configurationId; - private String serviceType; - private String vnfType; - private String vfModuleType; - private String networkType; - private String requestDetails; - private String recipeParamXsd; - - public Builder setRequestId(String requestId) { - this.requestId = requestId; - return this; - } - - public Builder setBaseVfModule(boolean baseVfModule) { - isBaseVfModule = baseVfModule; - return this; - } - - public Builder setRecipeTimeout(int recipeTimeout) { - this.recipeTimeout = recipeTimeout; - return this; - } - - public Builder setRequestAction(String requestAction) { - this.requestAction = requestAction; - return this; - } - - public Builder setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - return this; - } - - public Builder setCorrelationId(String correlationId) { - this.correlationId = correlationId; - return this; - } - - public Builder setVnfId(String vnfId) { - this.vnfId = vnfId; - return this; - } - - public Builder setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - return this; - } - - public Builder setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - return this; - } - - public Builder setNetworkId(String networkId) { - this.networkId = networkId; - return this; - } - - public Builder setConfigurationId(String configurationId) { - this.configurationId = configurationId; - return this; - } - - public Builder setServiceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - public Builder setVnfType(String vnfType) { - this.vnfType = vnfType; - return this; - } - - public Builder setVfModuleType(String vfModuleType) { - this.vfModuleType = vfModuleType; - return this; - } - - public Builder setNetworkType(String networkType) { - this.networkType = networkType; - return this; - } - - public Builder setRequestDetails(String requestDetails) { - this.requestDetails = requestDetails; - return this; - } - - public Builder setRecipeParamXsd(String recipeParamXsd) { - this.recipeParamXsd = recipeParamXsd; - return this; - } - - public RequestClientParamater build(){ - return new RequestClientParamater(this); - } - } - - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java deleted file mode 100644 index a8b8984343..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java +++ /dev/null @@ -1,194 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - - -import java.io.IOException; - -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.util.EntityUtils; -import org.openecomp.mso.apihandler.camundabeans.CamundaResponse; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.utils.RootIgnoringObjectMapper; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public class ResponseHandler { - - private CamundaResponse response; - private int status; - private String content = ""; - private HttpResponse httpResponse; - private int type; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - private static final String RESPONSE_CONTENT_MSG = "response content is: "; - - public ResponseHandler(HttpResponse httpResponse, int type) { - this.httpResponse = httpResponse; - this.type=type; - parseResponse(); - } - - - private void parseResponse() { - int statusCode = httpResponse.getStatusLine().getStatusCode(); - msoLogger.debug("Returned status is: " + statusCode); - status = setStatus(statusCode); - msoLogger.debug("Parsed status is: " + status); - if(type==CommonConstants.CAMUNDA){ - parseCamunda(); - }else if(type==CommonConstants.CAMUNDATASK){ - parseCamundaTask(); - }else { - parseBpel(); - } - - } - - - - @SuppressWarnings("unchecked") - private void parseCamunda(){ - try{ - HttpEntity entity = httpResponse.getEntity(); - content = EntityUtils.toString(entity); - } catch (IOException e) { - msoLogger.debug("IOException getting Camunda response content", e); - } - - ObjectMapper mapper = new RootIgnoringObjectMapper(CamundaResponse.class); - - try { - response = mapper.readValue(content, CamundaResponse.class); - } catch (IOException e) { - msoLogger.debug("IOException getting Camunda response content", e); - } - msoLogger.debug("json response is: " + content); - if(response!=null){ - content = response.getContent(); - } - msoLogger.debug(RESPONSE_CONTENT_MSG + content); - - - if(status!=HttpStatus.SC_ACCEPTED){ - msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "Camunda", String.valueOf(status), content, "Camunda", "parseCamunda", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda"); - } - } - - private void parseBpel(){ - - HttpEntity bpelEntity = httpResponse.getEntity(); - - try { - if (bpelEntity!=null) { - content = EntityUtils.toString(bpelEntity); - msoLogger.debug(RESPONSE_CONTENT_MSG + content); - - } - if(status!=HttpStatus.SC_ACCEPTED){ - msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "BPEL", String.valueOf(status), content, "BPEL", "parseBpel", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from BPEL"); - } - } - catch (IOException e) { - msoLogger.debug("IOException getting BPEL response content", e); - } - } - - private void parseCamundaTask(){ - - HttpEntity camundataskEntity = httpResponse.getEntity(); - - try { - if (camundataskEntity!=null) { - content = EntityUtils.toString(camundataskEntity); - msoLogger.debug(RESPONSE_CONTENT_MSG + content); - - } - if(status!=HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED){ - msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "CAMUNDATASK", String.valueOf(status), content, "CAMUNDATASK", "parseCamundaTask", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda Task"); - } - } - catch (IOException e) { - msoLogger.debug("IOException getting Camunda Task response content", e); - } - } - - private int setStatus(int statusCode){ - int httpStatus; - switch(statusCode) { - case HttpStatus.SC_ACCEPTED: - case HttpStatus.SC_OK: - httpStatus = HttpStatus.SC_ACCEPTED; - break; - case HttpStatus.SC_BAD_REQUEST: - httpStatus = HttpStatus.SC_BAD_REQUEST; - break; - case HttpStatus.SC_UNAUTHORIZED: - case HttpStatus.SC_FORBIDDEN: - httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR; - break; - case HttpStatus.SC_NOT_FOUND: - httpStatus = HttpStatus.SC_NOT_IMPLEMENTED; - break; - case HttpStatus.SC_INTERNAL_SERVER_ERROR: - httpStatus = HttpStatus.SC_BAD_GATEWAY; - break; - case HttpStatus.SC_SERVICE_UNAVAILABLE: - httpStatus = HttpStatus.SC_SERVICE_UNAVAILABLE; - break; - case HttpStatus.SC_NO_CONTENT: - httpStatus = HttpStatus.SC_NO_CONTENT; - break; - default: - httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR; - break; - } - return httpStatus; - } - - - public CamundaResponse getResponse() { - return response; - } - - - public void setResponse(CamundaResponse response) { - this.response = response; - } - - - public String getContent() { - return content; - } - - - public void setContent(String content) { - this.content = content; - } - - - public int getStatus() { - return status; - } -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java deleted file mode 100644 index 73bf020c21..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - - -public class ValidationException extends Exception { - - /** - * This class simply extends Exception (without addition additional functionality) - * to provide an identifier for RequestsDB related exceptions on create, delete, query. - * - * - **/ - - private static final long serialVersionUID = 1L; - private static final String VALIDATION_FAIL_MESSAGE = "No valid $ELEMENT is specified"; - private static final String INVALID_ELEMENT_MESSAGE = "$ELEMENT is not valid in the $VERSION version"; - private static final String ELEMENT_MESSAGE = "\\$ELEMENT"; - - public ValidationException (String msg) { - super (VALIDATION_FAIL_MESSAGE.replaceAll (ELEMENT_MESSAGE, msg)); - } - - public ValidationException (String msg, Exception cause) { - super (VALIDATION_FAIL_MESSAGE.replaceAll (ELEMENT_MESSAGE, msg), cause); - } - public ValidationException(String msg, String version) { - super(INVALID_ELEMENT_MESSAGE.replaceAll(ELEMENT_MESSAGE, msg).replaceAll("\\$VERSION", version)); - } -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java deleted file mode 100644 index ebb1dd28cf..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - - -import java.io.FileInputStream; -import java.io.IOException; - -import javax.xml.XMLConstants; -import javax.xml.transform.Source; -import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; -import javax.xml.validation.Validator; - -import org.apache.commons.io.IOUtils; -import org.xml.sax.SAXException; - -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; - -public class XMLValidator { - - private static String xsdsPath; - - static { - String prefixMsoPropertiesPath = System.getProperty ("mso.config.path"); - if (prefixMsoPropertiesPath == null) { - prefixMsoPropertiesPath = ""; - } - xsdsPath = prefixMsoPropertiesPath + "xsds/"; - } - - private String stringXsd; - private String errorMsg = null; - private SchemaFactory factory; - private Schema schema; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); - - public XMLValidator (String xsdFile) { - - try (FileInputStream xsdStream = new FileInputStream (xsdsPath + xsdFile)) { - - stringXsd = IOUtils.toString (xsdStream); - - factory = SchemaFactory.newInstance (XMLConstants.W3C_XML_SCHEMA_NS_URI); - factory.setResourceResolver (new PathResourceResolver (xsdsPath)); - factory.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true); - - String quotedXsd = stringXsd.replaceAll (""", "\""); - Source src = new StreamSource (new java.io.StringReader (quotedXsd)); - schema = factory.newSchema (src); - - } catch (IOException | SAXException e) { - msoLogger.debug ("Cannot open file " + xsdsPath + xsdFile, e); - errorMsg = "ErrorDetails: xsd file " + xsdFile + "could not be opened - " + e.getMessage (); - } - } - - // Returns null when XML valid, otherwise returns error details. - public String isXmlValid (String stringXml) { - try { - if (errorMsg != null && !errorMsg.isEmpty ()) { - return errorMsg; - } - Source src2 = new StreamSource (new java.io.StringReader (stringXml)); - Validator validator = schema.newValidator (); - validator.validate (src2); - - } catch (IOException | SAXException e) { - msoLogger.debug ("Exception: ", e); - return "ErrorDetails: " + e.getMessage (); - - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_CANNOT_READ_SCHEMA, "", "", MsoLogger.ErrorCode.SchemaError, "APIH cannot read schema file", e); - alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, "Unable to read the schema file"); - return "ErrorDetails: " + "Unable to read the schema file"; - } - - return null; - } -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/package-info.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/package-info.java deleted file mode 100644 index 7859412ead..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -/** - * Common classes for API Handlers. - */ -package org.openecomp.mso.apihandler.common; - diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BeansTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BeansTest.java new file mode 100644 index 0000000000..b596636f6d --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BeansTest.java @@ -0,0 +1,72 @@ +/*- + * ============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.camundabeans; + +import org.junit.Test; + +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterEnum; +import com.openpojo.reflection.filters.FilterNonConcrete; +import com.openpojo.reflection.filters.FilterPackageInfo; +import org.onap.so.openpojo.rules.HasToStringRule; +import org.onap.so.openpojo.rules.ToStringTester; + +public class BeansTest { + + + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + private PojoClassFilter enumFilter = new FilterEnum(); + + + @Test + public void pojoStructure() { + test("org.onap.so.apihandler.camundabeans"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + + + + + .with(new SetterTester()) + .with(new GetterTester()) + .with(new ToStringTester()) + + .build(); + + + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete()); + } + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BpmnRequestTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BpmnRequestTest.java new file mode 100644 index 0000000000..7087e90b73 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/BpmnRequestTest.java @@ -0,0 +1,178 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.camundabeans; + +import org.junit.Test; + +public class BpmnRequestTest { + + BpmnRequest bpmnRequest = new BpmnRequest(); + + @Test + public void getHostTest() throws Exception { + bpmnRequest.getHost(); + } + + @Test + public void setHostTest() throws Exception { + bpmnRequest.setHost(new CamundaInput()); + } + + @Test + public void getRequestIdTest() throws Exception { + bpmnRequest.getRequestId(); + } + + @Test + public void setRequestIdTest() throws Exception { + bpmnRequest.setRequestId(new CamundaInput()); + } + + @Test + public void getIsBaseVfModuleTest() throws Exception { + bpmnRequest.getIsBaseVfModule(); + } + + @Test + public void setIsBaseVfModuleTest() throws Exception { + bpmnRequest.setIsBaseVfModule(new CamundaBooleanInput()); + } + + @Test + public void getRecipeTimeoutTest() throws Exception { + bpmnRequest.getRecipeTimeout(); + } + + @Test + public void setRecipeTimeoutTest() throws Exception { + bpmnRequest.setRecipeTimeout(new CamundaIntegerInput()); + } + + @Test + public void getRequestActionTest() throws Exception { + bpmnRequest.getRequestAction(); + } + + @Test + public void setRequestActionTest() throws Exception { + bpmnRequest.setRequestAction(new CamundaInput()); + } + + @Test + public void getServiceInstanceIdTest() throws Exception { + bpmnRequest.getServiceInstanceId(); + } + + @Test + public void setServiceInstanceIdTest() throws Exception { + bpmnRequest.setServiceInstanceId(new CamundaInput()); + } + + @Test + public void getVnfIdTest() throws Exception { + bpmnRequest.getVnfId(); + } + + @Test + public void setVnfIdTest() throws Exception { + bpmnRequest.setVnfId(new CamundaInput()); + } + + @Test + public void getVfModuleIdTest() throws Exception { + bpmnRequest.getVnfId(); + } + + @Test + public void setVfModuleIdTest() throws Exception { + bpmnRequest.setVfModuleId(new CamundaInput()); + } + + @Test + public void getVolumeGroupIdTest() throws Exception { + bpmnRequest.getVolumeGroupId(); + } + + @Test + public void setVolumeGroupIdTest() throws Exception { + bpmnRequest.setVolumeGroupId(new CamundaInput()); + } + + @Test + public void getNetworkIdTest() throws Exception { + bpmnRequest.getNetworkId(); + } + + @Test + public void setNetworkIdTest() throws Exception { + bpmnRequest.setNetworkId(new CamundaInput()); + } + + @Test + public void getServiceTypeTest() throws Exception { + bpmnRequest.getServiceType(); + } + + @Test + public void setServiceTypeTest() throws Exception { + bpmnRequest.setServiceType(new CamundaInput()); + } + + @Test + public void getVnfTypeTest() throws Exception { + bpmnRequest.getVnfType(); + } + + @Test + public void setVnfTypeTest() throws Exception { + bpmnRequest.setVnfType(new CamundaInput()); + } + + @Test + public void getVfModuleTypeTest() throws Exception { + bpmnRequest.getVfModuleType(); + } + + @Test + public void setVfModuleTypeTest() throws Exception { + bpmnRequest.setVfModuleType(new CamundaInput()); + } + + @Test + public void getNetworkTypeTest() throws Exception { + bpmnRequest.getNetworkType(); + } + + @Test + public void setNetworkTypeTest() throws Exception { + bpmnRequest.setNetworkType(new CamundaInput()); + } + + @Test + public void getRequestDetailsTest() throws Exception { + bpmnRequest.getRequestDetails(); + } + + @Test + public void setRequestDetailsTest() throws Exception { + bpmnRequest.setRequestDetails(new CamundaInput()); + } + +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializerTest.java new file mode 100644 index 0000000000..36966342b2 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializerTest.java @@ -0,0 +1,36 @@ +/*- + * ============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.camundabeans; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by ANANDSAN on 4/10/2018. + */ +public class CamundaMacroRequestSerializerTest { + @Test + public void testWithAllParameters() throws Exception{ + String jsonRequest = CamundaMacroRequestSerializer.getJsonRequest("requestId", "action", "serviceInstanceId"); + Assert.assertNotNull(jsonRequest); + Assert.assertEquals("{\"variables\":{\"mso-request-id\":{\"value\":\"requestId\",\"type\":\"String\"},\"gAction\":{\"value\":\"action\",\"type\":\"String\"},\"serviceInstanceId\":{\"value\":\"serviceInstanceId\",\"type\":\"String\"}}}", jsonRequest); + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/AllTestsTestSuite.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/AllTestsTestSuite.java new file mode 100644 index 0000000000..47c166eff9 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/AllTestsTestSuite.java @@ -0,0 +1,33 @@ +/*- + * ============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 org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses("**/*Test.class") +public class AllTestsTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java new file mode 100644 index 0000000000..d7052762ab --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java @@ -0,0 +1,166 @@ +/*- + * ============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.common; + + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.message.BasicHttpResponse; +import org.apache.http.message.BasicStatusLine; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.onap.so.apihandler.common.CamundaClient; +import org.onap.so.apihandler.common.CommonConstants; +import org.onap.so.apihandler.common.RequestClient; +import org.onap.so.apihandler.common.RequestClientFactory; +import org.springframework.mock.env.MockEnvironment; + +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.databind.JsonMappingException; + + +/** + * This class implements test methods of Camunda Beans. + * + * + */ +public class CamundaClientTest{ + + + + @Mock + private HttpClient mockHttpClient; + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void tesCamundaPost() throws JsonGenerationException, + JsonMappingException, IOException { + + + String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}"; + + HttpResponse mockResponse = createResponse(200, responseBody); + mockHttpClient = Mockito.mock(HttpClient.class); + Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class))) + .thenReturn(mockResponse); + + String reqXML = "test"; + String orchestrationURI = "/engine-rest/process-definition/key/dummy/start"; + MockEnvironment environment = new MockEnvironment(); + + environment.setProperty("mso.camundaUR", "yourValue1"); + + + RequestClientFactory reqClientFactory = new RequestClientFactory(); + reqClientFactory.setEnv(environment); + RequestClient requestClient = reqClientFactory.getRequestClient(orchestrationURI); + + requestClient.setClient(mockHttpClient); + HttpResponse response = requestClient.post(reqXML, "reqId", "timeout", "version", null, null); + + + int statusCode = response.getStatusLine().getStatusCode(); + assertEquals(requestClient.getType(), CommonConstants.CAMUNDA); + assertEquals(statusCode, HttpStatus.SC_OK); + + + requestClient = reqClientFactory.getRequestClient(orchestrationURI); + requestClient.setClient(mockHttpClient); + response = requestClient.post(null, "reqId", null, null, null, null); + assertEquals(requestClient.getType(), CommonConstants.CAMUNDA); + assertEquals(statusCode, HttpStatus.SC_OK); + } + + private HttpResponse createResponse(int respStatus, + String respBody) { + HttpResponse response = new BasicHttpResponse( + new BasicStatusLine( + new ProtocolVersion("HTTP", 1, 1), respStatus, "")); + response.setStatusCode(respStatus); + try { + response.setEntity(new StringEntity(respBody)); + response.setHeader("Content-Type", "application/json"); + } catch (Exception e) { + e.printStackTrace(); + } + return response; + } + + public String inputStream(String JsonInput)throws IOException{ + JsonInput = "src/test/resources/CamundaClientTest" + JsonInput; + String input = new String(Files.readAllBytes(Paths.get(JsonInput))); + return input; + } + + @Test + public void wrapVIDRequestTest() throws IOException{ + CamundaClient testClient = new CamundaClient(); + testClient.setUrl("/mso/async/services/CreateGenericALaCarteServiceInstance"); + + String requestId = "f7ce78bb-423b-11e7-93f8-0050569a796"; + boolean isBaseVfModule = true; + int recipeTimeout = 10000; + String requestAction = "createInstance"; + String serviceInstanceId = "12345679"; + String correlationId = "12345679"; + String vnfId = "234567891"; + String vfModuleId = "345678912"; + String volumeGroupId = "456789123"; + String networkId = "567891234"; + String configurationId = "678912345"; + String serviceType = "testService"; + String vnfType = "testVnf"; + String vfModuleType = "vfModuleType"; + String networkType = "networkType"; + String requestDetails = "{requestDetails: }"; + String apiVersion = "6"; + boolean aLaCarte = true; + String requestUri = "v7/serviceInstances/assign"; + + String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, correlationId, + vnfId, vfModuleId, volumeGroupId, networkId, configurationId, serviceType, + vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, ""); + String expected = inputStream("/WrappedVIDRequest.json"); + + assertEquals(expected, testResult); + } + + + + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaTaskClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaTaskClientTest.java new file mode 100644 index 0000000000..69772ee7e6 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaTaskClientTest.java @@ -0,0 +1,139 @@ +/*- + * ============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.common; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +import org.apache.http.HttpEntity; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpRequestBase; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.apihandler.common.CamundaTaskClient; +import org.onap.so.apihandler.common.CommonConstants; +import org.onap.so.apihandler.common.RequestClientParameter; +import org.springframework.core.env.Environment; + +@RunWith(MockitoJUnitRunner.class) +public class CamundaTaskClientTest { + + @Mock + private Environment env; + private CamundaTaskClient testedObject = new CamundaTaskClient(); + private HttpClient httpClientMock; + private static final String JSON_REQUEST = "{\"value1\": \"aaa\",\"value2\": \"bbb\"}"; + private static final String URL_SCHEMA = "http"; + private static final String HOST = "testhost"; + private static final int PORT = 1234; + private static final String URL_PATH = "/requestMethodSuccessful"; + private static final String URL = URL_SCHEMA + "://" + HOST + ":" + PORT + URL_PATH; + private static final String AUTHORIZATION_HEADER_NAME = "Authorization"; + + @Before + public void init() { + when(env.getProperty(eq(CommonConstants.CAMUNDA_AUTH))).thenReturn(""); + testedObject = new CamundaTaskClient(); + httpClientMock = mock(HttpClient.class); + testedObject.setClient(httpClientMock); + testedObject.setUrl(URL); + } + + @Test + public void postMethodSuccessful() throws IOException { + ArgumentCaptor httpPostCaptor = ArgumentCaptor.forClass(HttpPost.class); + testedObject.post(JSON_REQUEST); + verify(httpClientMock).execute(httpPostCaptor.capture()); + checkUri(httpPostCaptor.getValue()); + assertThat(httpPostCaptor.getValue().getEntity().getContentType().getValue()). + isEqualTo(CommonConstants.CONTENT_TYPE_JSON); + assertThat(getJsonFromEntity(httpPostCaptor.getValue().getEntity())).isEqualTo(JSON_REQUEST); + } + + @Test + public void postMethodSuccessfulWithCredentials() throws IOException { + ArgumentCaptor httpPostCaptor = ArgumentCaptor.forClass(HttpPost.class); + testedObject.setProps(env); + testedObject.post(JSON_REQUEST); + verify(httpClientMock).execute(httpPostCaptor.capture()); + assertThat(httpPostCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)).isNotEmpty(); + } + + @Test + public void getMethodSuccessful() throws IOException { + ArgumentCaptor httpGetCaptor = ArgumentCaptor.forClass(HttpGet.class); + testedObject.get(); + verify(httpClientMock).execute(httpGetCaptor.capture()); + checkUri(httpGetCaptor.getValue()); + } + + @Test + public void getMethodSuccessfulWithCredentials() throws IOException { + ArgumentCaptor httpGetCaptor = ArgumentCaptor.forClass(HttpGet.class); + testedObject.setUrl(URL); + testedObject.setProps(env); + testedObject.get(); + verify(httpClientMock).execute(httpGetCaptor.capture()); + assertThat(httpGetCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)).isNotEmpty(); + } + + @Test(expected = UnsupportedOperationException.class) + public void postMethodUnsupported() { + testedObject.post("", "", "", "", "", ""); + } + + @Test(expected = UnsupportedOperationException.class) + public void postMethodUnsupported2() { + testedObject.post(new RequestClientParameter.Builder().build()); + } + + private void checkUri(HttpRequestBase httpRequestBase) { + assertThat(httpRequestBase.getURI().getScheme()).isEqualTo(URL_SCHEMA); + assertThat(httpRequestBase.getURI().getHost()).isEqualTo(HOST); + assertThat(httpRequestBase.getURI().getPort()).isEqualTo(PORT); + assertThat(httpRequestBase.getURI().getPath()).isEqualTo(URL_PATH); + } + + private String getJsonFromEntity(HttpEntity httpEntity) throws IOException { + BufferedReader rd = new BufferedReader( + new InputStreamReader(httpEntity.getContent())); + StringBuilder result = new StringBuilder(); + String line; + while ((line = rd.readLine()) != null) { + result.append(line); + } + return result.toString(); + } + +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java new file mode 100644 index 0000000000..7bb054c297 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java @@ -0,0 +1,139 @@ +/*- + * ============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.common; + + +import static org.hamcrest.Matchers.hasProperty; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.startsWith; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; + +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.ProtocolVersion; +import org.apache.http.entity.StringEntity; +import org.apache.http.message.BasicHttpResponse; +import org.apache.http.message.BasicStatusLine; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.apihandler.common.ErrorNumbers; +import org.onap.so.apihandler.common.ResponseHandler; + +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.databind.JsonMappingException; +import org.onap.so.apihandlerinfra.exceptions.ApiException; +import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException; +import org.onap.so.apihandlerinfra.exceptions.ValidateException; + +/** + * This class implements test methods of CamundaResoponseHandler. + * + * + */ +public class ResponseHandlerTest{ + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Test + public void tesParseCamundaResponse () throws ApiException { + // String body + // ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}"; + + String body = "{ \"response\": \"xml\"," + "\"messageCode\": 200," + + "\"message\": \"Successfully started the process\"}"; + + HttpResponse response = createResponse (200, body, "application/json"); + + ResponseHandler respHandler = new ResponseHandler (response, 1); + + int status = respHandler.getStatus (); + assertEquals (status, HttpStatus.SC_ACCEPTED); + assertEquals (respHandler.getResponse ().getMessage (), "Successfully started the process"); + + } + + @Test + public void tesParseBpelResponse () throws ApiException{ + String body = "" + + "req5" + + "test" + + "test" + + "n" + + ""; + + HttpResponse response = createResponse (200, body, "text/xml"); + + ResponseHandler respHandler = new ResponseHandler (response, 0); + + int status = respHandler.getStatus (); + assertEquals (status, HttpStatus.SC_ACCEPTED); + assertTrue (respHandler.getResponseBody () != null); + } + + @Test + public void tesMappingErrorResponse () throws ApiException { + thrown.expect(ValidateException.class); + thrown.expectMessage(startsWith("JSON Object Mapping Request")); + thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_BAD_REQUEST))); + thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER))); + + HttpResponse response = createResponse (HttpStatus.SC_NOT_FOUND, "error", "text/html"); + ResponseHandler respHandler = new ResponseHandler (response, 1); + + int status = respHandler.getStatus (); + + assertEquals (HttpStatus.SC_NOT_IMPLEMENTED, status); + + } + + @Test + public void tesGenricErrorResponse () throws ApiException { + + String body = "{ \"response\": \"xml\"," + "\"messageCode\": 500," + + "\"message\": \"Something went wrong\"}"; + + HttpResponse response = createResponse (500, body, "application/json"); + ResponseHandler respHandler = new ResponseHandler (response, 1); + int status = respHandler.getStatus (); + assertEquals (status, HttpStatus.SC_BAD_GATEWAY); + assertEquals (respHandler.getResponse ().getMessage (), "Something went wrong"); + } + + private HttpResponse createResponse (int respStatus, String respBody, String contentType) { + HttpResponse response = new BasicHttpResponse (new BasicStatusLine (new ProtocolVersion ("HTTP", 1, 1), + respStatus, + "")); + response.setStatusCode (respStatus); + try { + response.setEntity (new StringEntity (respBody)); + response.setHeader ("Content-Type", contentType); + } catch (Exception e) { + e.printStackTrace (); + } + return response; + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandlerTest.java new file mode 100644 index 0000000000..564121b7b5 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandlerTest.java @@ -0,0 +1,72 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 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.recipe; + +import static org.junit.Assert.assertEquals; + +import java.io.ByteArrayInputStream; +import java.io.IOException; + +import org.springframework.http.HttpStatus; +import org.springframework.http.client.ClientHttpResponse; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; + +public class CamundaClientErrorHandlerTest { + + private ClientHttpResponse clientHttpResponse; + private CamundaClientErrorHandler clientErrorHandler; + + @Before + public void before() { + clientHttpResponse = Mockito.mock(ClientHttpResponse.class); + clientErrorHandler = new CamundaClientErrorHandler(); + } + + @Test + public void handleError_SERVER_ERROR_Test() throws IOException { + Mockito.when(clientHttpResponse.getStatusCode()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR); + Mockito.when(clientHttpResponse.getBody()).thenReturn(new ByteArrayInputStream("{}".getBytes())); + clientErrorHandler.handleError(clientHttpResponse); + boolean serverHasError = clientErrorHandler.hasError(clientHttpResponse); + assertEquals(true, serverHasError); + } + + @Test + public void handleError_CLIENT_ERROR_Test() throws IOException { + Mockito.when(clientHttpResponse.getStatusCode()).thenReturn(HttpStatus.BAD_REQUEST); + Mockito.when(clientHttpResponse.getBody()).thenReturn(new ByteArrayInputStream("{}".getBytes())); + clientErrorHandler.handleError(clientHttpResponse); + boolean clientHasError = clientErrorHandler.hasError(clientHttpResponse); + assertEquals(true, clientHasError); + } + + @Test + public void handleError_SUCCESS_Test() throws IOException { + Mockito.when(clientHttpResponse.getStatusCode()).thenReturn(HttpStatus.ACCEPTED); + Mockito.when(clientHttpResponse.getBody()).thenReturn(new ByteArrayInputStream("{}".getBytes())); + clientErrorHandler.handleError(clientHttpResponse); + boolean hasNoError = clientErrorHandler.hasError(clientHttpResponse); + assertEquals(false, hasNoError); + } + +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionMapperTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionMapperTest.java new file mode 100644 index 0000000000..b98c47490a --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionMapperTest.java @@ -0,0 +1,97 @@ +/*- + * ============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 com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.so.apihandler.common.ErrorNumbers; +import org.onap.so.apihandlerinfra.exceptions.*; + +import org.apache.http.HttpStatus; +import javax.ws.rs.core.Response; + + +import java.io.IOException; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.anyObject; +import static org.hamcrest.core.StringStartsWith.startsWith; + +public class ApiExceptionMapperTest { + + ApiExceptionMapper mapper = new ApiExceptionMapper(); + + + @Test + public void testObjectMapperError() throws JsonProcessingException { + ObjectMapper mockedMapper = Mockito.mock(ObjectMapper.class); + Mockito.when(mockedMapper.writeValueAsString(anyObject())).thenThrow(JsonProcessingException.class); + ValidateException validateException = new ValidateException.Builder("Test", 0 , null).build(); + ApiExceptionMapper mockedException = Mockito.spy(new ApiExceptionMapper()); + Mockito.doReturn(mockedMapper).when(mockedException).createObjectMapper(); + Response resp = mockedException.toResponse((ApiException) validateException); + + /// assertEquals(resp.getStatus(), HttpStatus.SC_BAD_REQUEST); + assertThat(resp.getEntity().toString(),startsWith("Exception in buildServiceErrorResponse writing exceptionType to string")); + } + + @Test + public void testValidateResponse(){ + ValidateException validateException = new ValidateException.Builder("Test Message", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).build(); + Response resp = mapper.toResponse((ApiException) validateException); + + assertEquals(resp.getStatus(), HttpStatus.SC_BAD_REQUEST); + } + + @Test + public void testBPMNFailureResponse(){ + BPMNFailureException bpmnException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER).build(); + Response resp = mapper.toResponse((ApiException) bpmnException); + + assertEquals(resp.getStatus(), HttpStatus.SC_NOT_FOUND); + } + @Test + public void testClientConnectionResponse(){ + ClientConnectionException clientConnectionException = new ClientConnectionException.Builder("test", HttpStatus.SC_INTERNAL_SERVER_ERROR,ErrorNumbers.SVC_BAD_PARAMETER).build(); + Response resp = mapper.toResponse((ApiException) clientConnectionException); + + assertEquals(resp.getStatus(), HttpStatus.SC_INTERNAL_SERVER_ERROR); + } + @Test + public void testVFModuleResponse() { + VfModuleNotFoundException vfModuleException = new VfModuleNotFoundException.Builder("Test Message", HttpStatus.SC_CONFLICT,ErrorNumbers.SVC_BAD_PARAMETER).build(); + Response resp = mapper.toResponse((ApiException) vfModuleException); + + assertEquals(resp.getStatus(), HttpStatus.SC_CONFLICT); + } + @Test + public void testDuplicateRequestResponse() throws IOException { + DuplicateRequestException duplicateRequestException = new DuplicateRequestException.Builder("Test1", "Test2","Test3","Test4", HttpStatus.SC_BAD_GATEWAY,ErrorNumbers.SVC_BAD_PARAMETER).build(); + Response resp = mapper.toResponse((ApiException) duplicateRequestException); + + assertEquals(resp.getStatus(), HttpStatus.SC_BAD_GATEWAY); + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java new file mode 100644 index 0000000000..bd3728c599 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java @@ -0,0 +1,128 @@ +/*- + * ============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.apache.http.HttpStatus; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.apihandler.common.ErrorNumbers; +import org.onap.so.apihandlerinfra.exceptions.*; +import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo; +import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; + +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; + +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.hamcrest.Matchers.hasProperty; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.startsWith; + + +public class ApiExceptionTest { + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Test + public void testRecipeNotFoundException() throws ApiException { + thrown.expect(RecipeNotFoundException.class); + thrown.expectMessage("Message rewritten"); + thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND))); + thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER))); + RecipeNotFoundException testException = new RecipeNotFoundException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).message("Message rewritten").build(); + throw testException; + } + + + @Test + public void testBPMNFailureException() throws ApiException { + List testVariables = new LinkedList<>(); + testVariables.add("hello"); + thrown.expect(BPMNFailureException.class); + thrown.expectMessage(startsWith("Request Failed due to BPEL error with HTTP Status =")); + thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND))); + thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER))); + thrown.expect(hasProperty("variables",sameBeanAs(testVariables))); + BPMNFailureException testException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).variables(testVariables).build(); + throw testException; + } + + + @Test + public void testClientConnectionException() throws ApiException { + IOException ioException = new IOException(); + thrown.expect(ClientConnectionException.class); + thrown.expectMessage("Client from test failed to connect"); + thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND))); + thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER))); + thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND))); + thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER))); + thrown.expect(hasProperty("cause", sameBeanAs(ioException))); + ClientConnectionException testException = new ClientConnectionException.Builder("test", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).cause(ioException).build(); + throw testException; + } + + + @Test + public void testDuplicateRequestException() throws ApiException { + ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + thrown.expect(DuplicateRequestException.class); + thrown.expectMessage(startsWith("Error: Locked instance")); + thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND))); + thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER))); + thrown.expect(hasProperty("errorLoggerInfo", sameBeanAs(testLog))); + DuplicateRequestException testException = new DuplicateRequestException.Builder("Test1", "Test2","Test3","Test4", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(testLog).build(); + throw testException; + } + + + @Test + public void testValidateException() throws ApiException { + AlarmLoggerInfo testLog = new AlarmLoggerInfo.Builder("MsoConfigurationError", MsoAlarmLogger.CRITICAL, + Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_SDNC_ADAPTER)).build(); + thrown.expect(ValidateException.class); + thrown.expectMessage("Test Message"); + thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND))); + thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR))); + thrown.expect(hasProperty("alarmLoggerInfo", sameBeanAs(testLog))); + ValidateException testException = new ValidateException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).messageID(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).alarmInfo(testLog).build(); + throw testException; + } + + + @Test + public void testVfModuleNotFoundException() throws ApiException { + thrown.expect(VfModuleNotFoundException.class); + thrown.expectMessage("Test Message"); + thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_CONFLICT))); + thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER))); + VfModuleNotFoundException testException = new VfModuleNotFoundException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).httpResponseCode(HttpStatus.SC_CONFLICT).build(); + throw testException; + } + + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/TestAppender.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/TestAppender.java new file mode 100644 index 0000000000..48711a2595 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/TestAppender.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; + +import java.util.ArrayList; +import java.util.List; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.AppenderBase; + + + +public class TestAppender extends AppenderBase { + public static List events = new ArrayList<>(); + + @Override + protected void append(ILoggingEvent loggingEvent) { + events.add(loggingEvent); + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/camundabeans/BeansTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/camundabeans/BeansTest.java deleted file mode 100644 index f9d7f87e53..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/camundabeans/BeansTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.camundabeans; - -import org.junit.Test; - -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.rule.impl.SetterMustExistRule; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.PojoClassFilter; -import com.openpojo.reflection.filters.FilterEnum; -import com.openpojo.reflection.filters.FilterNonConcrete; -import com.openpojo.reflection.filters.FilterPackageInfo; -import org.openecomp.mso.openpojo.rules.HasToStringRule; -import org.openecomp.mso.openpojo.rules.ToStringTester; - -public class BeansTest { - - - private PojoClassFilter filterTestClasses = new FilterTestClasses(); - - private PojoClassFilter enumFilter = new FilterEnum(); - - - @Test - public void pojoStructure() { - test("org.openecomp.mso.apihandler.camundabeans"); - } - - private void test(String pojoPackage) { - Validator validator = ValidatorBuilder.create() - - - - - .with(new SetterTester()) - .with(new GetterTester()) - .with(new ToStringTester()) - - .build(); - - - validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete()); - } - private static class FilterTestClasses implements PojoClassFilter { - public boolean include(PojoClass pojoClass) { - return !pojoClass.getSourcePath().contains("/test-classes/"); - } - } -} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequestTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequestTest.java deleted file mode 100644 index 6490f52a02..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequestTest.java +++ /dev/null @@ -1,178 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.apihandler.camundabeans; - -import org.junit.Test; - -public class BpmnRequestTest { - - BpmnRequest bpmnRequest = new BpmnRequest(); - - @Test - public void getHostTest() throws Exception { - bpmnRequest.getHost(); - } - - @Test - public void setHostTest() throws Exception { - bpmnRequest.setHost(new CamundaInput()); - } - - @Test - public void getRequestIdTest() throws Exception { - bpmnRequest.getRequestId(); - } - - @Test - public void setRequestIdTest() throws Exception { - bpmnRequest.setRequestId(new CamundaInput()); - } - - @Test - public void getIsBaseVfModuleTest() throws Exception { - bpmnRequest.getIsBaseVfModule(); - } - - @Test - public void setIsBaseVfModuleTest() throws Exception { - bpmnRequest.setIsBaseVfModule(new CamundaBooleanInput()); - } - - @Test - public void getRecipeTimeoutTest() throws Exception { - bpmnRequest.getRecipeTimeout(); - } - - @Test - public void setRecipeTimeoutTest() throws Exception { - bpmnRequest.setRecipeTimeout(new CamundaIntegerInput()); - } - - @Test - public void getRequestActionTest() throws Exception { - bpmnRequest.getRequestAction(); - } - - @Test - public void setRequestActionTest() throws Exception { - bpmnRequest.setRequestAction(new CamundaInput()); - } - - @Test - public void getServiceInstanceIdTest() throws Exception { - bpmnRequest.getServiceInstanceId(); - } - - @Test - public void setServiceInstanceIdTest() throws Exception { - bpmnRequest.setServiceInstanceId(new CamundaInput()); - } - - @Test - public void getVnfIdTest() throws Exception { - bpmnRequest.getVnfId(); - } - - @Test - public void setVnfIdTest() throws Exception { - bpmnRequest.setVnfId(new CamundaInput()); - } - - @Test - public void getVfModuleIdTest() throws Exception { - bpmnRequest.getVnfId(); - } - - @Test - public void setVfModuleIdTest() throws Exception { - bpmnRequest.setVfModuleId(new CamundaInput()); - } - - @Test - public void getVolumeGroupIdTest() throws Exception { - bpmnRequest.getVolumeGroupId(); - } - - @Test - public void setVolumeGroupIdTest() throws Exception { - bpmnRequest.setVolumeGroupId(new CamundaInput()); - } - - @Test - public void getNetworkIdTest() throws Exception { - bpmnRequest.getNetworkId(); - } - - @Test - public void setNetworkIdTest() throws Exception { - bpmnRequest.setNetworkId(new CamundaInput()); - } - - @Test - public void getServiceTypeTest() throws Exception { - bpmnRequest.getServiceType(); - } - - @Test - public void setServiceTypeTest() throws Exception { - bpmnRequest.setServiceType(new CamundaInput()); - } - - @Test - public void getVnfTypeTest() throws Exception { - bpmnRequest.getVnfType(); - } - - @Test - public void setVnfTypeTest() throws Exception { - bpmnRequest.setVnfType(new CamundaInput()); - } - - @Test - public void getVfModuleTypeTest() throws Exception { - bpmnRequest.getVfModuleType(); - } - - @Test - public void setVfModuleTypeTest() throws Exception { - bpmnRequest.setVfModuleType(new CamundaInput()); - } - - @Test - public void getNetworkTypeTest() throws Exception { - bpmnRequest.getNetworkType(); - } - - @Test - public void setNetworkTypeTest() throws Exception { - bpmnRequest.setNetworkType(new CamundaInput()); - } - - @Test - public void getRequestDetailsTest() throws Exception { - bpmnRequest.getRequestDetails(); - } - - @Test - public void setRequestDetailsTest() throws Exception { - bpmnRequest.setRequestDetails(new CamundaInput()); - } - -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/common/CamundaTaskClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/common/CamundaTaskClientTest.java deleted file mode 100644 index f892d13599..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/common/CamundaTaskClientTest.java +++ /dev/null @@ -1,132 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.apihandler.common; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import org.apache.http.HttpEntity; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpRequestBase; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.openecomp.mso.properties.MsoJavaProperties; - -public class CamundaTaskClientTest { - - private CamundaTaskClient testedObject = new CamundaTaskClient(); - private HttpClient httpClientMock; - private static final String JSON_REQUEST = "{\"value1\": \"aaa\",\"value2\": \"bbb\"}"; - private static final String URL_SCHEMA = "http"; - private static final String HOST = "testhost"; - private static final int PORT = 1234; - private static final String URL_PATH = "/requestMethodSuccessful"; - private static final String URL = URL_SCHEMA + "://" + HOST + ":" + PORT + URL_PATH; - private static final String AUTHORIZATION_HEADER_NAME = "Authorization"; - - @Before - public void init() { - testedObject = new CamundaTaskClient(); - httpClientMock = mock(HttpClient.class); - testedObject.setClient(httpClientMock); - testedObject.setUrl(URL); - } - - @Test - public void postMethodSuccessful() throws IOException { - ArgumentCaptor httpPostCaptor = ArgumentCaptor.forClass(HttpPost.class); - testedObject.post(JSON_REQUEST); - verify(httpClientMock).execute(httpPostCaptor.capture()); - checkUri(httpPostCaptor.getValue()); - assertThat(httpPostCaptor.getValue().getEntity().getContentType().getValue()). - isEqualTo(CommonConstants.CONTENT_TYPE_JSON); - assertThat(getJsonFromEntity(httpPostCaptor.getValue().getEntity())).isEqualTo(JSON_REQUEST); - } - - @Test - public void postMethodSuccessfulWithCredentials() throws IOException { - ArgumentCaptor httpPostCaptor = ArgumentCaptor.forClass(HttpPost.class); - testedObject.setProps(createMsoJavaProperties()); - testedObject.post(JSON_REQUEST); - verify(httpClientMock).execute(httpPostCaptor.capture()); - assertThat(httpPostCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)).isNotEmpty(); - } - - @Test - public void getMethodSuccessful() throws IOException { - ArgumentCaptor httpGetCaptor = ArgumentCaptor.forClass(HttpGet.class); - testedObject.get(); - verify(httpClientMock).execute(httpGetCaptor.capture()); - checkUri(httpGetCaptor.getValue()); - } - - @Test - public void getMethodSuccessfulWithCredentials() throws IOException { - ArgumentCaptor httpGetCaptor = ArgumentCaptor.forClass(HttpGet.class); - testedObject.setUrl(URL); - testedObject.setProps(createMsoJavaProperties()); - testedObject.get(); - verify(httpClientMock).execute(httpGetCaptor.capture()); - assertThat(httpGetCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)).isNotEmpty(); - } - - @Test(expected = UnsupportedOperationException.class) - public void postMethodUnsupported() { - testedObject.post("", "", "", "", "", ""); - } - - @Test(expected = UnsupportedOperationException.class) - public void postMethodUnsupported2() { - testedObject.post(new RequestClientParamater.Builder().build()); - } - - private void checkUri(HttpRequestBase httpRequestBase) { - assertThat(httpRequestBase.getURI().getScheme()).isEqualTo(URL_SCHEMA); - assertThat(httpRequestBase.getURI().getHost()).isEqualTo(HOST); - assertThat(httpRequestBase.getURI().getPort()).isEqualTo(PORT); - assertThat(httpRequestBase.getURI().getPath()).isEqualTo(URL_PATH); - } - - private MsoJavaProperties createMsoJavaProperties() { - MsoJavaProperties msoJavaProperties = new MsoJavaProperties(); - msoJavaProperties.setProperty(CommonConstants.CAMUNDA_AUTH, ""); - return msoJavaProperties; - } - - private String getJsonFromEntity(HttpEntity httpEntity) throws IOException { - BufferedReader rd = new BufferedReader( - new InputStreamReader(httpEntity.getContent())); - StringBuilder result = new StringBuilder(); - String line; - while ((line = rd.readLine()) != null) { - result.append(line); - } - return result.toString(); - } - -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java deleted file mode 100644 index 6cc6c562e5..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.camunda.tests; - - -import static org.junit.Assert.assertEquals; - -import java.io.IOException; - -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.ProtocolVersion; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.message.BasicHttpResponse; -import org.apache.http.message.BasicStatusLine; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.openecomp.mso.apihandler.common.CommonConstants; -import org.openecomp.mso.apihandler.common.RequestClient; -import org.openecomp.mso.apihandler.common.RequestClientFactory; -import org.openecomp.mso.properties.MsoJavaProperties; - -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.databind.JsonMappingException; - - -/** - * This class implements test methods of Camunda Beans. - * - * - */ -public class BPELRestClientTest { - - - - @Mock - private HttpClient mockHttpClient; - - @Before - public void setUp() { - MockitoAnnotations.initMocks(this); - } - - @Test - public void tesBPELPost() throws JsonGenerationException, - JsonMappingException, IOException { - - - String responseBody ="" - + "req5" - + "Layer3ServiceActivateRequest" - + "OMX" - + "n" - + ""; - - HttpResponse mockResponse = createResponse(200, responseBody); - mockHttpClient = Mockito.mock(HttpClient.class); - Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class))) - .thenReturn(mockResponse); - - String reqXML = "test"; - String orchestrationURI = "/active-bpel/services/REST/MsoLayer3ServiceActivate"; - - MsoJavaProperties props = new MsoJavaProperties(); - props.setProperty(CommonConstants.BPEL_URL, "http://localhost:8089"); - props.setProperty("bpelAuth", "786864AA53D0DCD881AED1154230C0C3058D58B9339D2EFB6193A0F0D82530E1"); - - RequestClient requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props); - requestClient.setClient(mockHttpClient); - HttpResponse response = requestClient.post(reqXML, "reqId", "timeout", "version", null, null); - - - int statusCode = response.getStatusLine().getStatusCode(); - assertEquals(requestClient.getType(), CommonConstants.BPEL); - assertEquals(statusCode, HttpStatus.SC_OK); - - - } - - private HttpResponse createResponse(int respStatus, - String respBody) { - HttpResponse response = new BasicHttpResponse( - new BasicStatusLine( - new ProtocolVersion("HTTP", 1, 1), respStatus, "")); - response.setStatusCode(respStatus); - try { - response.setEntity(new StringEntity(respBody)); - response.setHeader("Content-Type", "text/xml"); - } catch (Exception e) { - e.printStackTrace(); - } - return response; - } - - - - - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java deleted file mode 100644 index 69927e2126..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.camunda.tests; - - -import static org.junit.Assert.assertEquals; - -import java.io.IOException; - -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.ProtocolVersion; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.message.BasicHttpResponse; -import org.apache.http.message.BasicStatusLine; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.openecomp.mso.apihandler.common.CommonConstants; -import org.openecomp.mso.apihandler.common.RequestClient; -import org.openecomp.mso.apihandler.common.RequestClientFactory; -import org.openecomp.mso.apihandler.common.RequestClientParamater; -import org.openecomp.mso.properties.MsoJavaProperties; - -/** - * This class implements test methods of Camunda Beans. - * - * - */ -public class CamundaClientTest { - - - - @Mock - private HttpClient mockHttpClient; - - @Before - public void setUp() { - MockitoAnnotations.initMocks(this); - } - - @Test - public void tesCamundaPost() throws IOException { - String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}"; - - HttpResponse mockResponse = createResponse(200, responseBody); - mockHttpClient = Mockito.mock(HttpClient.class); - Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class))) - .thenReturn(mockResponse); - - String reqXML = "test"; - String orchestrationURI = "/engine-rest/process-definition/key/dummy/start"; - - MsoJavaProperties props = new MsoJavaProperties(); - props.setProperty(CommonConstants.CAMUNDA_URL, "http://localhost:8089"); - - RequestClient requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props); - requestClient.setClient(mockHttpClient); - HttpResponse response = requestClient.post(reqXML, "reqId", "timeout", "version", null, null); - - - int statusCode = response.getStatusLine().getStatusCode(); - assertEquals(requestClient.getType(), CommonConstants.CAMUNDA); - assertEquals(statusCode, HttpStatus.SC_OK); - - props.setProperty (CommonConstants.CAMUNDA_AUTH, "ABCD1234"); - requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props); - requestClient.setClient(mockHttpClient); - response = requestClient.post(null, "reqId", null, null, null, null); - assertEquals(requestClient.getType(), CommonConstants.CAMUNDA); - assertEquals(statusCode, HttpStatus.SC_OK); - } - - @Test - public void testCamundaPostJson() throws IOException { - String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}"; - - HttpResponse mockResponse = createResponse(200, responseBody); - mockHttpClient = Mockito.mock(HttpClient.class); - Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class))) - .thenReturn(mockResponse); - String orchestrationURI = "/engine-rest/process-definition/key/dummy/start"; - - MsoJavaProperties props = new MsoJavaProperties(); - props.setProperty(CommonConstants.CAMUNDA_URL, "http://localhost:8089"); - - RequestClient requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props); - requestClient.setClient(mockHttpClient); - HttpResponse response = requestClient.post(createParams()); - assertEquals(requestClient.getType(), CommonConstants.CAMUNDA); - assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK); - } - - private HttpResponse createResponse(int respStatus, - String respBody) { - HttpResponse response = new BasicHttpResponse( - new BasicStatusLine( - new ProtocolVersion("HTTP", 1, 1), respStatus, "")); - response.setStatusCode(respStatus); - try { - response.setEntity(new StringEntity(respBody)); - response.setHeader("Content-Type", "application/json"); - } catch (Exception e) { - e.printStackTrace(); - } - return response; - } - - private RequestClientParamater createParams(){ - return new RequestClientParamater.Builder().setRequestId("mso-req-id").setBaseVfModule(false). - setRecipeTimeout(180).setRequestAction("createInstance").setServiceInstanceId("svc-inst-id"). - setVnfId("vnf-id").setVfModuleId("vf-module-id").setVolumeGroupId("vg-id").setNetworkId("nw-id"). - setConfigurationId("conf-id").setServiceType("svc-type").setVnfType("vnf-type"). - setVfModuleType("vf-module-type").setNetworkType("nw-type").setRequestDetails(""). - setRecipeParamXsd("").build(); - } - - - - - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java deleted file mode 100644 index 622bb1e242..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.camunda.tests; - - - -import static org.junit.Assert.assertEquals; - -import java.io.IOException; - -import org.junit.Test; -import org.openecomp.mso.apihandler.camundabeans.CamundaInput; -import org.openecomp.mso.apihandler.camundabeans.CamundaRequest; -import org.openecomp.mso.apihandler.common.CommonConstants; - -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -/** - * This class implements test methods of Camunda Beans. - * - * - */ -public class CamundaRequestTest { - - @Test - public final void testSerialization() throws JsonGenerationException, - JsonMappingException, IOException { - CamundaRequest camundaRequest = new CamundaRequest(); - CamundaInput camundaInput = new CamundaInput(); - CamundaInput host = new CamundaInput(); - CamundaInput schema = new CamundaInput(); - CamundaInput reqid = new CamundaInput(); - CamundaInput svcid = new CamundaInput(); - CamundaInput timeout = new CamundaInput(); - camundaInput - .setValue(" 155415ab-b4a7-4382-b4c6-d17d950604Layer3ServiceActivateRequestOMXhttps://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws50515631 SDN-ETHERNET-INTERNETHI/VLXM/950604//SW_INTERNETSubName01 MTSNJA4LCP1 "); - camundaRequest.setServiceInput(camundaInput); - host.setValue("localhost"); - camundaRequest.setHost(host); - schema.setValue("v1"); - camundaRequest.setSchema(schema); - reqid.setValue("reqid123"); - camundaRequest.setReqid(reqid); - svcid.setValue("svcid123"); - camundaRequest.setSvcid(svcid); - timeout.setValue(""); - camundaRequest.setTimeout(timeout); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - - String json = mapper.writeValueAsString(camundaRequest); - System.out.println(json); - assertEquals( - "{\"variables\":{\""+CommonConstants.CAMUNDA_SERVICE_INPUT+"\":{\"value\":\" 155415ab-b4a7-4382-b4c6-d17d950604Layer3ServiceActivateRequestOMXhttps://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws50515631 SDN-ETHERNET-INTERNETHI/VLXM/950604//SW_INTERNETSubName01 MTSNJA4LCP1 \",\"type\":\"String\"}" + - ",\"host\":{\"value\":\"localhost\",\"type\":\"String\"},\"mso-schema-version\":{\"value\":\"v1\",\"type\":\"String\"},\"mso-request-id\":{\"value\":\"reqid123\",\"type\":\"String\"},\"mso-service-instance-id\":{\"value\":\"svcid123\",\"type\":\"String\"},\"mso-service-request-timeout\":{\"value\":\"\",\"type\":\"String\"}}}", - json); - - } - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java deleted file mode 100644 index 7fc2815b4b..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.camunda.tests; - - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.mso.apihandler.camundabeans.CamundaResponse; -import org.openecomp.mso.utils.RootIgnoringObjectMapper; - -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * This class implements test methods of Camunda Beans. - * - * - */ -public class CamundaResponseTest { - - @Test - public final void testDeserializationWithoutRootElement() throws Exception { - - ObjectMapper mapper = new RootIgnoringObjectMapper(CamundaResponse.class); - - String content = "{" - + "\"messageCode\":202" - + ",\"message\":\"Successfully started the process\"" - + ",\"content\":\"xml\"" - + ",\"processInstanceId\":\"4d3b3201a7ce\"" - + ",\"variables\":null" - + "}"; - - CamundaResponse response = mapper.readValue(content, CamundaResponse.class); - - assertEquals( - "CamundaResponse[processInstanceId=4d3b3201a7ce,messageCode=202,message=Successfully started the process,variables=null,content=xml]", - response.toString()); - } - - @Test - public final void testDeserializationWithRootElement() throws Exception { - - ObjectMapper mapper = new RootIgnoringObjectMapper(CamundaResponse.class); - - String content = "{\"WorkflowResponse\":{" - + "\"messageCode\":202" - + ",\"message\":\"Successfully started the process\"" - + ",\"content\":\"xml\"" - + ",\"processInstanceId\":\"4d3b3201a7ce\"" - + ",\"variables\":null" - + "}}"; - - CamundaResponse response = mapper.readValue(content, CamundaResponse.class); - - assertEquals( - "CamundaResponse[processInstanceId=4d3b3201a7ce,messageCode=202,message=Successfully started the process,variables=null,content=xml]", - response.toString()); - } -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java deleted file mode 100644 index e04aba0ede..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.camunda.tests; - - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; - -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.ProtocolVersion; -import org.apache.http.entity.StringEntity; -import org.apache.http.message.BasicHttpResponse; -import org.apache.http.message.BasicStatusLine; -import org.junit.Test; -import org.openecomp.mso.apihandler.common.ResponseHandler; - -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.databind.JsonMappingException; - -/** - * This class implements test methods of CamundaResoponseHandler. - * - * - */ -public class ResponseHandlerTest { - - @Test - public void tesParseCamundaResponse () throws JsonGenerationException, JsonMappingException, IOException { - - String content = "{\"WorkflowResponse\":{" - + "\"messageCode\":202" - + ",\"message\":\"Successfully started the process\"" - + ",\"content\":\"xml\"" - + ",\"processInstanceId\":\"4d3b3201a7ce\"" - + "}}"; - - HttpResponse response = createResponse (200, content, "application/json"); - - ResponseHandler respHandler = new ResponseHandler (response, 1); - - int status = respHandler.getStatus (); - assertEquals (status, HttpStatus.SC_ACCEPTED); - assertEquals (respHandler.getResponse ().getMessage (), "Successfully started the process"); - - } - - @Test - public void tesParseBpelResponse () throws JsonGenerationException, JsonMappingException, IOException { - String body = "" - + "req5" - + "Layer3ServiceActivateRequest" - + "OMX" - + "n" - + ""; - - HttpResponse response = createResponse (200, body, "text/xml"); - - ResponseHandler respHandler = new ResponseHandler (response, 0); - - int status = respHandler.getStatus (); - assertEquals (status, HttpStatus.SC_ACCEPTED); - assertTrue (respHandler.getContent() != null); - } - - @Test - public void tes404ErrorResponse () throws JsonGenerationException, JsonMappingException, IOException { - - - HttpResponse response = createResponse (HttpStatus.SC_NOT_FOUND, "error", "text/html"); - ResponseHandler respHandler = new ResponseHandler (response, 1); - - int status = respHandler.getStatus (); - - assertEquals (HttpStatus.SC_NOT_IMPLEMENTED, status); - - } - - @Test - public void tesGenricErrorResponse () throws JsonGenerationException, JsonMappingException, IOException { - - String content = "{\"WorkflowResponse\":{" - + "\"messageCode\":500" - + ",\"message\":\"Something went wrong\"" - + ",\"content\":\"xml\"" - + ",\"processInstanceId\":\"4d3b3201a7ce\"" - + "}}"; - - HttpResponse response = createResponse (500, content, "application/json"); - - ResponseHandler respHandler = new ResponseHandler (response, 1); - - int status = respHandler.getStatus (); - assertEquals (HttpStatus.SC_BAD_GATEWAY, status); - assertEquals (respHandler.getResponse ().getMessage (), "Something went wrong"); - System.out.println (respHandler.getContent()); - - } - - private HttpResponse createResponse (int respStatus, String respBody, String contentType) { - HttpResponse response = new BasicHttpResponse (new BasicStatusLine (new ProtocolVersion ("HTTP", 1, 1), - respStatus, - "")); - response.setStatusCode (respStatus); - try { - response.setEntity (new StringEntity (respBody)); - response.setHeader ("Content-Type", contentType); - } catch (Exception e) { - e.printStackTrace (); - } - return response; - } - -} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json new file mode 100644 index 0000000000..c4c7b030f9 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json @@ -0,0 +1 @@ +{"variables":{"bpmnRequest":{"value":"{requestDetails: }","type":"String"},"requestId":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"mso-request-id":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"isBaseVfModule":{"value":true,"type":"Boolean"},"recipeTimeout":{"value":10000,"type":"Integer"},"requestAction":{"value":"createInstance","type":"String"},"serviceInstanceId":{"value":"12345679","type":"String"},"correlationId":{"value":"12345679","type":"String"},"vnfId":{"value":"234567891","type":"String"},"vfModuleId":{"value":"345678912","type":"String"},"volumeGroupId":{"value":"456789123","type":"String"},"networkId":{"value":"567891234","type":"String"},"configurationId":{"value":"678912345","type":"String"},"serviceType":{"value":"testService","type":"String"},"vnfType":{"value":"testVnf","type":"String"},"vfModuleType":{"value":"vfModuleType","type":"String"},"networkType":{"value":"networkType","type":"String"},"recipeParams":{"value":"","type":"String"},"host":{"value":null,"type":"String"},"apiVersion":{"value":"6","type":"String"},"aLaCarte":{"value":true,"type":"Boolean"},"requestUri":{"value":"v7/serviceInstances/assign","type":"String"}}} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-common/src/test/resources/logback-test.xml b/mso-api-handlers/mso-api-handler-common/src/test/resources/logback-test.xml deleted file mode 100644 index d2c17192ea..0000000000 --- a/mso-api-handlers/mso-api-handler-common/src/test/resources/logback-test.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - %d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n - - - - - - - - - - - - - - - - - - - - - - diff --git a/mso-api-handlers/mso-api-handler-infra/WebContent/META-INF/MANIFEST.MF b/mso-api-handlers/mso-api-handler-infra/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e9495128c..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/beans.xml b/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/beans.xml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/jboss-deployment-structure.xml b/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/jboss-deployment-structure.xml deleted file mode 100644 index e687384774..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/jboss-deployment-structure.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/jboss-web.xml b/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/jboss-web.xml deleted file mode 100644 index 984bfc6589..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/jboss-web.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - ecomp/mso/infra - other - diff --git a/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/web.xml b/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/web.xml deleted file mode 100644 index bbd7c61bb9..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,165 +0,0 @@ - - - - MSO API Handler Infra - - - org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap - - - - resteasy.jndi.resources - java:module/MsoPropertiesFactory - - - - - resteasy.async.job.service.enabled - true - - - - - - - resteasy.async.job.service.max.job.results - 100 - - - - - resteasy.async.job.service.max.wait - 300000 - - - - resteasy.scan - true - - - - - resteasy.async.job.service.thread.pool.size - 100 - - - - - resteasy.async.job.service.base.path - /asynch/jobs - - - - log.configuration - logback.apihandler-infra.xml - - - - mso.configuration - MSO_PROP_APIHANDLER_INFRA=mso.apihandler-infra.properties,MSO_PROP_TOPOLOGY=topology.properties - - - - resteasy.resources - org.openecomp.mso.logger.MsoLoggingServlet - - - - resteasy-servlet - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - - - resteasy-servlet - /serviceInstances/* - /orchestrationRequests/* - /nodehealthcheck - /v1/* - /v2/* - /v3/* - /logging/* - /globalhealthcheck/* - /healthcheck/* - /setStatus/* - /properties/* - /api-docs/* - /tasks/* - /e2eServiceInstances/* - /cloudResources/* - /cloudResourcesRequests/* - - - - - - HealthcheckNoAuth - No Authentication for Healthcheck - /healthcheck - /globalhealthcheck - /nodehealthcheck - GET - POST - - - - - SiteStatus - SiteStatus APIs - /setStatus/* - POST - - - SiteControl-Client - - - - - MSO internal Requests - Internal Requests - /logging/* - /properties/* - POST - GET - - - MSO-Client - - - - - HTTPBasicAuth - Authentication for Infra Portal - /* - POST - GET - - - InfraPortal-Client - - - - - BASIC - ApplicationRealm - - - InfraPortal-Client - - - SiteControl-Client - - - MSO-Client - - - - LogFilter - org.openecomp.mso.logger.LogFilter - - - LogFilter - /* - - - \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/WebContent/check.html b/mso-api-handlers/mso-api-handler-infra/WebContent/check.html deleted file mode 100644 index ea2f0e265a..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/WebContent/check.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - -Health Check - - -Application ready - - - diff --git a/mso-api-handlers/mso-api-handler-infra/WebContent/index.xhtml b/mso-api-handlers/mso-api-handler-infra/WebContent/index.xhtml deleted file mode 100644 index f902af8cc0..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/WebContent/index.xhtml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - <h:outputText value="#{msg.welcomeTitle}" /> - - - -

-

- - diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index 97bd8348d3..f871e120e7 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -5,72 +5,97 @@ org.onap.so mso-api-handlers - 1.2.0-SNAPSHOT + 1.3.0-SNAPSHOT mso-api-handler-infra mso-api-handler-infra - ECOMP MSO API Handler Infra + ONAP SO API Handler Infra UTF-8 UTF-8 - 3.2.9.RELEASE 1.3.0 1.1.1 3.2.4 3.0.0 - 2.8.7 - 2.9.1-1 0.9.9-RC1 - 3.16.1-GA 2.5.2 1.0.3 + 1.9.2 + 1.8 - + + + + + org.springframework.boot + spring-boot-dependencies + ${springboot.version} + pom + import + + + - org.jboss.resteasy - resteasy-jaxrs - 3.5.0.Final - provided + org.springframework.boot + spring-boot-starter-web - - org.jboss.resteasy - resteasy-client - 3.5.0.Final - - - org.camunda.bpm - camunda-engine - 7.8.0-alpha1 - provided + io.swagger + swagger-jersey2-jaxrs + 1.5.16 - org.jboss.spec.javax.ejb - jboss-ejb-api_3.2_spec - 1.0.0.Final - provided + com.h2database + h2 - org.jboss.ejb3 - jboss-ejb3-ext-api - 2.2.0.Final - provided + org.mariadb.jdbc + mariadb-java-client + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-jersey + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.apache.tomcat + tomcat-jdbc + + + + + org.apache.commons + commons-dbcp2 + + + commons-lang + commons-lang + 2.6 + + + antlr + antlr - javax.activation activation 1.1.1 - provided - javax.ws.rs - jsr311-api - ${jax-rs-version} + javax.transaction + jta + 1.1 org.json4s @@ -85,214 +110,213 @@ com.fasterxml.jackson.core jackson-databind - ${fasterxml-json-version} - - - - org.codehaus.jackson - jackson-core-asl - 1.9.13 - - - com.fasterxml.jackson.core - jackson-databind - 2.8.7 - - - - com.thoughtworks.paranamer - paranamer - ${paranamer-version} - org.scala-lang - scala-library - ${scala-lang-version} - - - - org.scala-lang - scala-compiler - 2.12.4 + com.fasterxml.jackson.core + jackson-core - org.reflections - reflections - ${reflections-version} + com.fasterxml.jackson.core + jackson-annotations javax.servlet servlet-api 2.5 - provided org.javassist javassist - ${javassist-version} - org.scannotation - scannotation - ${scannotation-version} + org.json + json - - com.wordnik - swagger-jersey-jaxrs_2.9.1 - ${swagger-version} - provided + com.fasterxml.jackson.jaxrs + jackson-jaxrs-base - com.wordnik - swagger-annotations_2.9.1 - ${swagger-version} + com.fasterxml.jackson.jaxrs + jackson-jaxrs-providers + 2.9.2 + pom + + - com.wordnik - swagger-core_2.9.1 - ${swagger-version} + org.onap.so + mso-requests-db + ${project.version} - com.wordnik - swagger-jaxrs_2.9.1 - ${swagger-version} + org.onap.so + mso-catalog-db + ${project.version} - - - org.springframework - spring-core - ${spring-version} + org.onap.so + MSORESTClient + ${project.version} + + - org.springframework - spring-context - ${spring-version} + pl.pragmatists + JUnitParams + 1.0.5 + test - org.springframework - spring-web - 4.3.2.RELEASE + junit + junit + test - org.springframework - spring-aop - ${spring-version} + org.onap.sdc.sdc-distribution-client + sdc-distribution-client + 1.3.0 + + + org.slf4j + slf4j-log4j12 + + - org.springframework - spring-tx - ${spring-version} + org.onap.so + MSORESTClient + ${project.version} - org.springframework - spring-expression - ${spring-version} + com.github.java-json-tools + json-schema-core + 1.2.8 - org.springframework - spring-context-support - ${spring-version} + com.github.java-json-tools + json-schema-validator + 2.2.8 - org.springframework - spring-beans - ${spring-version} + janino + janino + 2.5.15 - org.onap.so - mso-catalog-db - ${project.version} - - - org.onap.so - mso-requests-db - ${project.version} + org.springframework.boot + spring-boot-starter-test + test - org.onap.so - mso-api-handler-common - ${project.version} + com.h2database + h2 - org.onap.so - status-control - ${project.version} + commons-beanutils + commons-beanutils - org.json - json - 20160212 - - - org.jmockit - jmockit - 1.19 - test + org.springframework.boot + spring-boot-configuration-processor + true - junit - junit - 4.12 + ch.vorburger.mariaDB4j + mariaDB4j + 2.2.3 test - - pl.pragmatists - JUnitParams - 1.0.5 - test + + com.googlecode.junit-toolbox + junit-toolbox + 2.4 - com.openpojo - openpojo - 0.8.6 - test + org.onap.so + mso-api-handler-common + ${project.version} - org.onap.sdc.sdc-distribution-client - sdc-distribution-client - 1.3.0 + org.springframework.cloud + spring-cloud-contract-wiremock + 1.2.4.RELEASE test - - org.onap.sdc.sdc-distribution-client - sdc-distribution-client - 1.3.0 - - - org.slf4j - slf4j-log4j12 - - - - org.onap.so - MSORESTClient - ${project.version} - + io.micrometer + micrometer-spring-legacy + 1.0.5 + - javax - javaee-web-api - 6.0 - provided + io.micrometer + micrometer-registry-prometheus + 1.0.5 - + ${project.artifactId}-${project.version} - - maven-war-plugin - 2.4 + org.apache.maven.plugins + maven-surefire-plugin + + + default-test + + test + + + + **/AllTestsTestSuite.java + + + + + + + org.springframework.boot + spring-boot-maven-plugin - WebContent - false - true + org.onap.so.apihandlerinfra.ApiHandlerApplication + + + + repackage + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + extract-docker-file + + + + + org.apache.maven.plugins + maven-jar-plugin + + + original + + + + + io.fabric8 + fabric8-maven-plugin + + + start + + - war - + jar + \ No newline at end of file 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 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 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 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 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 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 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 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 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 userParams; + // userParams = + // e2eSir.getService().getParameters().getRequestParameters().getUserParams(); + List> userParamList = new ArrayList<>(); + Map userParamMap = new HashMap<>(); + // complete json request updated in the camunda + userParamMap.put("UUIRequest", requestJSON); + userParamMap.put("ServiceInstanceName", e2eSir.getService().getName()); + + // Map userParamMap3 = null; + // for (E2EUserParam userp : userParams) { + // userParamMap.put(userp.getName(), userp.getValue()); + // + // } + userParamList.add(userParamMap); + requestParameters.setUserParams(userParamList); + + // setting requestParameters to requestDetails + requestDetails.setRequestParameters(requestParameters); + + sir.setRequestDetails(requestDetails); + + return sir; + } + + + private void parseRequest(ServiceInstancesRequest sir, HashMap 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 = "Health CheckApplication ready"; + + 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 errors = new HashMap<>(); + static { + errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_service", "Service request FAILED schema validation. %s"); + errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_feature", "Feature request FAILED schema validation. %s"); + errors.put(ErrorNumbers.RECIPE_DOES_NOT_EXIST, "Recipe for %s-type and action specified does not exist in catalog %s"); + errors.put(ErrorNumbers.SERVICE_PARAMETERS_FAILED_SCHEMA_VALIDATION, "Service specific parameters passed in request FAILED schema validation. %s"); + + errors.put(ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS, "%s-name (%s) is locked (status = %s) because already working on a CREATE request with same %s-name."); + errors.put(ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID, "%s-id (%s) is locked (status = %s) because already working on a request with same action (%s) for this %s-id."); + errors.put(ErrorNumbers.REQUEST_TIMED_OUT, "Service request timed out before completing"); + errors.put(ErrorNumbers.ERROR_FROM_BPEL, "BPEL returned an error: %s"); + errors.put(ErrorNumbers.NO_COMMUNICATION_TO_BPEL, "Could not communicate with BPEL %s"); + errors.put(ErrorNumbers.NO_RESPONSE_FROM_BPEL, "No response from BPEL %s"); + errors.put(ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, "Could not insert or update record in MSO_REQUESTS DB %s"); + errors.put(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, "Could not communicate with MSO_REQUESTS DB %s"); + errors.put(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB, "Could not communicate with MSO_CATALOG DB %s"); + errors.put(ErrorNumbers.ERROR_FROM_CATALOG_DB, "Received error from MSO_CATALOG DB %s"); + } + + private Messages(){ + } + + public static Map getErrors() { + return errors; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 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 instanceIdMap, Actions action, String version, + String originalRequestJSON, int reqVersion, Boolean aLaCarteFlag) throws ValidationException, IOException { + + msoLogger.debug ("Validating the Service Instance request"); + List 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 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> getOrchestrationFilters (MultivaluedMap queryParams) throws ValidationException { + + String queryParam = null; + Map> orchestrationFilterParams = new HashMap<>(); + + + for (Entry> entry : queryParams.entrySet()) { + queryParam = entry.getKey(); + + try{ + if("filter".equalsIgnoreCase(queryParam)){ + for(String value : entry.getValue()) { + StringTokenizer st = new StringTokenizer(value, ":"); + + int counter=0; + String mapKey=null; + List orchestrationList = new ArrayList<>(); + while (st.hasMoreElements()) { + if(counter == 0){ + mapKey = st.nextElement() + ""; + } else{ + orchestrationList.add(st.nextElement() + ""); + } + counter++; + } + orchestrationFilterParams.put(mapKey, orchestrationList); + } + } + + }catch(Exception e){ + //msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, e); + throw new ValidationException ("QueryParam ServiceInfo", e); + + } + + } + + + return orchestrationFilterParams; + } + + public 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 = "Health CheckApplication ready"; + + 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 queryParams = ui.getQueryParameters(); + + List activeRequests = null; + + GetOrchestrationListResponse orchestrationList = null; + Map> 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 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 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 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 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 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 instanceIdMap = new HashMap(); + 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 variables = new ArrayList(); + //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 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 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 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> 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 params : reqParams.getUserParams()){ + if(params.containsKey("service")){ + Service service = serviceMapper(params); + + Optional 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 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> configureUserParams(RequestParameters reqParams) throws IOException { + msoLogger.debug("Configuring UserParams for Macro Request"); + Map userParams = new HashMap<>(); + + for(Map 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 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 targetUserParams, List> sourceUserParams) { + for(Map map : sourceUserParams) { + for (Map.Entry entry : map.entrySet()) { + targetUserParams.put(entry.getKey(), entry.getValue()); + } + } + } + + protected List> mapFlatMapToNameValue(Map flatMap) { + List> targetUserParams = new ArrayList<>(); + + for(Map.Entry map : flatMap.entrySet()) { + Map 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 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 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 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 oModelName = retrieveModelName(sir.getRequestDetails().getRequestParameters()); + if (oModelName.isPresent()) { + defaultModel = oModelName.get(); + } + return defaultModel; + } + + private Response configurationRecipeLookup(String requestJSON, Action action, HashMap 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 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 = 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 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 locationConstraints; + + @JsonProperty("resources") + private List resources; + + @JsonProperty("requestInputs") + private HashMap requestInputs; + + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + public Map getAdditionalProperties() { + return additionalProperties; + } + + public void setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + /** + * @return Returns the resources. + */ + public List getResources() { + return resources; + } + + /** + * @param resources The resources to set. + */ + public void setResources(List resources) { + this.resources = resources; + } + + public List getLocationConstraints() { + return locationConstraints; + } + + public void setLocationConstraints(List locationConstraints) { + this.locationConstraints = locationConstraints; + } + + public HashMap getRequestInputs() { + return requestInputs; + } + + public void setRequestInputs(HashMap requestInputs) { + this.requestInputs = requestInputs; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 additionalProperties = new HashMap<>(); + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public E2EParameters getParameters() { + return parameters; + } + + public void setParameters(E2EParameters parameters) { + this.parameters = parameters; + } + + public Map getAdditionalProperties() { + return additionalProperties; + } + + public void setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + public String getServiceInvariantUuid() { + return serviceInvariantUuid; + } + + public void setServiceInvariantUuid(String serviceInvariantUuid) { + this.serviceInvariantUuid = serviceInvariantUuid; + } + + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getServiceUuid() { + return serviceUuid; + } + + public void setServiceUuid(String serviceUuid) { + this.serviceUuid = serviceUuid; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 additionalProperties = new HashMap<>(); + + public E2EService getService() { + return service; + } + + public void setService(E2EService service) { + this.service = service; + } + + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + + + public void setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 additionalProperties = new HashMap<>(); + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + public void setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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; + +/** + *
+ *

+ *

+ * + * @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; + +/** + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class NsParameters { + + private List locationConstraints; + + private Map additionalParamForNs = new HashMap<>(); + /** + * @return Returns the locationConstraints. + */ + public List getLocationConstraints() { + return locationConstraints; + } + + /** + * @param locationConstraints The locationConstraints to set. + */ + public void setLocationConstraints(List locationConstraints) { + this.locationConstraints = locationConstraints; + } + + + /** + * @return Returns the additionalParamForNs. + */ + public Map getAdditionalParamForNs() { + return additionalParamForNs; + } + + + /** + * @param additionalParamForNs The additionalParamForNs to set. + */ + public void setAdditionalParamForNs(Map additionalParamForNs) { + this.additionalParamForNs = additionalParamForNs; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 additionalProperties = new HashMap<>(); + + /** + * @return Returns the resourceName. + */ + public String getResourceName() { + return resourceName; + } + + /** + * @param resourceName The resourceName to set. + */ + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public Map getAdditionalProperties() { + return additionalProperties; + } + + public void setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + public String getResourceInvariantUuid() { + return resourceInvariantUuid; + } + + public void setResourceInvariantUuid(String resourceInvariantUuid) { + this.resourceInvariantUuid = resourceInvariantUuid; + } + + public String getResourceUuid() { + return resourceUuid; + } + + public void setResourceUuid(String resourceUuid) { + this.resourceUuid = resourceUuid; + } + + public String getResourceCustomizationUuid() { + return resourceCustomizationUuid; + } + + public void setResourceCustomizationUuid(String resourceCustomizationUuid) { + this.resourceCustomizationUuid = resourceCustomizationUuid; + } + + public E2EParameters getParameters() { + return parameters; + } + + public void setParameters(E2EParameters parameters) { + this.parameters = parameters; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 resources; + + public String getServiceInstanceName() { + return serviceInstanceName; + } + + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + public List getResources() { + return resources; + } + + public void setResources(List resources) { + this.resources = resources; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.01.08 at 03:50:12 PM EST +// + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.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 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 getValidResponses() { + return validResponses; + } + + /** + * Sets the value of the validResponses property. + * + * @param value + * allowed object is + * {@link ValidResponses } + * + */ + public void setValidResponses(List 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 taskVariables; + + public List getTaskVariables() { + return taskVariables; + } + + public void setTaskVariables(List taskVariables) { + this.taskVariables = taskVariables; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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; + + public List getTaskList() { + return taskList; + } + + public void setTaskList(List taskList) { + this.taskList = taskList; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + + +package org.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; + + @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 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 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 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 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 queryParams = ui.getQueryParameters(); + List 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 activeRequests = null; + CloudOrchestrationRequestList orchestrationList = null; + + + Map 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 requestLists = new ArrayList(); + + 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; + + @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 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 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 = 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 getOrchestrationFilters (MultivaluedMap queryParams) throws ValidationException { + String queryParam = null; + Map orchestrationFilterParams = new HashMap<>(); + + for (Entry> entry : queryParams.entrySet()) { + queryParam = entry.getKey(); + try{ + for(String value : entry.getValue()) { + if(StringUtils.isBlank(value)) { + throw (new Exception(queryParam + " value")); + } + orchestrationFilterParams.put(queryParam, value); + } + }catch(Exception e){ + throw new ValidationException (e.getMessage(), 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 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 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 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 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 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 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 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 list + * @param workloadContext - String + * @param distributionStatusRepository - OperationalEnvDistributionStatusRepository object + * @param modelStatusRepository - OperationalEnvServiceModelStatusRepository object + * @return jsonResponse - JSONObject object + */ + public void processActivateSDCRequest(String requestId, String operationalEnvironmentId, List 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 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 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 buildEndPointRequestList(ServiceEndPointList serviceEndPointList) throws TenantIsolationException { + List endpointList = serviceEndPointList.getServiceEndPointList(); + msoLogger.debug("Number of service endpoints from GRM: " + endpointList.size()); + List serviceEndPointRequestList = new ArrayList(); + for(ServiceEndPoint serviceEndpoint : endpointList) { + serviceEndPointRequestList.add(buildServiceEndpoint(serviceEndpoint)); + } + return serviceEndPointRequestList; + } + + + private ServiceEndPointRequest buildServiceEndpoint(ServiceEndPoint serviceEndpoint) throws TenantIsolationException { + + //@TODO: handle nulls? Put in a ServiceEndpointWrapper class which will check for nulls and flatten access to fields + Version ver = new Version(); + ver.setMajor(serviceEndpoint.getVersion().getMajor()); + ver.setMinor(serviceEndpoint.getVersion().getMinor()); + ver.setPatch(serviceEndpoint.getVersion().getPatch()); + + ServiceEndPoint endpoint = new ServiceEndPoint(); + endpoint.setName(buildServiceNameForVnf(serviceEndpoint.getName())); + + endpoint.setVersion(ver); + endpoint.setHostAddress(serviceEndpoint.getHostAddress()); + endpoint.setListenPort(serviceEndpoint.getListenPort()); + endpoint.setLatitude(serviceEndpoint.getLatitude()); + endpoint.setLongitude(serviceEndpoint.getLongitude()); + endpoint.setContextPath(serviceEndpoint.getContextPath()); + endpoint.setRouteOffer(serviceEndpoint.getRouteOffer()); + + OperationalInfo operInfo = new OperationalInfo(); + operInfo.setCreatedBy(serviceEndpoint.getOperationalInfo().getCreatedBy()); + operInfo.setUpdatedBy(serviceEndpoint.getOperationalInfo().getUpdatedBy()); + + endpoint.setOperationalInfo(operInfo); + endpoint.setProperties(serviceEndpoint.getProperties()); + + String env = getEnvironmentName(serviceEndpoint.getProperties()); + + ServiceEndPointRequest serviceEndPontRequest = new ServiceEndPointRequest(); + serviceEndPontRequest.setEnv(env); + serviceEndPontRequest.setServiceEndPoint(endpoint); + + return serviceEndPontRequest; + } + + + protected String getEnvironmentName(List props) { + String env = ""; + for(Property prop : props) { + if(prop.getName().equalsIgnoreCase("Environment")) { + env = prop.getValue(); + } + } + return env; + } + + + protected String buildServiceNameForVnf(String fqName) throws TenantIsolationException { + // Service name format is: {tenantContext}.{workloadContext}.{serviceName} e.g. TEST.ECOMP_PSL.Inventory + // We need to extract the serviceName, in the above example: "Inventory" + String[] tokens = fqName.split("[.]"); + String serviceName; + if(tokens.length > 0) { + serviceName = tokens[tokens.length-1]; + } + else { + throw new TenantIsolationException("Fully qualified service name is null."); + } + String tenantContext = 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 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 requestList; + + public List getRequestList() { + return requestList; + } + + public void setRequestList(List requestList) { + this.requestList = requestList; + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 = new ArrayList(); + + public List getServiceModelList() { + return serviceModelList; + } + + public void setServiceModelList(List serviceModelList) { + this.serviceModelList = serviceModelList; + } + + @Override + public String toString() { + return "Manifest [serviceModelList=" + serviceModelList.toString() + "]"; + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + +package org.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 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 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 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 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 getInstanceIdMap(){ + return this.instanceIdMap; + } + public void setInstanceIdMap(HashMap 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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + + +package org.onap.so.apihandlerinfra.vnfbeans; + + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for action-type. + * + *

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

+ *

+ * <simpleType name="action-type">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="CREATE"/>
+ *     <enumeration value="SETSTATUS"/>
+ *     <enumeration value="REPLACE"/>
+ *     <enumeration value="UPDATE"/>
+ *     <enumeration value="DELETE"/>
+ *     <enumeration value="CREATE_VF_MODULE"/>
+ *     <enumeration value="UPDATE_VF_MODULE"/>
+ *     <enumeration value="DELETE_VF_MODULE"/>
+ *     <enumeration value="NOT_PROVIDED"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "action-type") +@XmlEnum +public enum ActionType { + + CREATE, + SETSTATUS, + REPLACE, + UPDATE, + DELETE, + CREATE_VF_MODULE, + UPDATE_VF_MODULE, + DELETE_VF_MODULE, + NOT_PROVIDED; + + public String value() { + return name(); + } + + public static ActionType fromValue(String v) { + return valueOf(v); + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + + +package org.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. + *

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 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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + + +package org.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; + + +/** + *

Java class for anonymous complex type. + * + *

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

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="request-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="action" type="{http://org.onap/so/infra/vnf-request/v1}action-type"/>
+ *         <element name="request-status" type="{http://org.onap/so/infra/vnf-request/v1}request-status-type" minOccurs="0"/>
+ *         <element name="status-message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="progress" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="start-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="end-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "requestId", + "action", + "requestStatus", + "statusMessage", + "progress", + "startTime", + "endTime", + "source" +}) +@XmlRootElement(name = "request-info") +public class RequestInfo { + + @XmlElement(name = "request-id") + protected String requestId; + @XmlElement(required = true) + protected ActionType action; + @XmlElement(name = "request-status") + protected RequestStatusType requestStatus; + @XmlElement(name = "status-message") + protected String statusMessage; + protected 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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + + +package org.onap.so.apihandlerinfra.vnfbeans; + + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlType; + + +/** + *

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

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

+ *

+ * <simpleType name="request-status-type">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="COMPLETE"/>
+ *     <enumeration value="FAILED"/>
+ *     <enumeration value="IN_PROGRESS"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "request-status-type") +@XmlEnum +public enum RequestStatusType { + + COMPLETE, + FAILED, + IN_PROGRESS, + PENDING, + TIMEOUT, + UNLOCKED; + + public String value() { + return name(); + } + + public static RequestStatusType fromValue(String v) { + return valueOf(v); + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + + +package org.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; + + +/** + *

Java class for anonymous complex type. + * + *

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

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="model-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="model-version" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="model-invariant-uuid" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="is-base" type="{http://www.w3.org/2001/XMLSchema}Boolean"/>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="asdc-service-model-version" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "modelName", + "modelVersion", + "modelInvariantUuid", + "isBase", + "id", + "description", + "asdcServiceModelVersion" +}) +@XmlRootElement(name = "vf-module-model-name") +public class VfModuleModelName { + + @XmlElement(name="model-name", required = true) + protected String modelName; + @XmlElement(name="model-version", required = true) + protected String modelVersion; + @XmlElement(name="model-invariant-uuid", required = true) + protected String modelInvariantUuid; + @XmlElement(name="is-base", required = true) + protected Boolean isBase; + @XmlElement(name="id", required = true) + protected String id; + @XmlElement(name="description", required = true) + protected String description; + @XmlElement(name="asdc-service-model-version", required = true) + protected String asdcServiceModelVersion; + + /** + * Gets the value of the modelName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getModelName() { + return modelName; + } + + /** + * Sets the value of the modelName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setModelName(String value) { + this.modelName = value; + } + + /** + * Gets the value of the modelVersion property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getModelVersion() { + return modelVersion; + } + + /** + * Sets the value of the modelVersion property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setModelVersion(String value) { + this.modelVersion = value; + } + + /** + * Gets the value of the modelInvariantUuid property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + + /** + * Sets the value of the modelInvariantUuid property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setModelInvariantUuid(String value) { + this.modelInvariantUuid = value; + } + + /** + * Gets the value of the isBase property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean getIsBase() { + return isBase; + } + + /** + * Sets the value of the isBase property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setIsBase(Boolean value) { + this.isBase = value; + } + + /** + * Gets the value of the id property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + /** + * Gets the value of the description property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescription() { + return description; + } + + /** + * Sets the value of the description property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescription(String value) { + this.description = value; + } + + /** + * Gets the value of the asdcServiceModelVersion property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAsdcServiceModelVersion() { + return asdcServiceModelVersion; + } + + /** + * Sets the value of the asdcServiceModelVersion property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAsdcServiceModelVersion(String value) { + this.asdcServiceModelVersion = value; + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + + +package org.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; + + +/** + *

Java class for anonymous complex type. + * + *

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

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

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

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

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

+ * Objects of the following type(s) are allowed in the list + * {@link VfModuleModelName } + * + * + */ + public List getVfModuleModelName() { + if (vfModuleModelName == null) { + vfModuleModelName = new ArrayList<>(); + } + return this.vfModuleModelName; + } + + public void setVfModuleModelName(List vfModuleModelName) { + this.vfModuleModelName=vfModuleModelName; + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + + +package org.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; + + +/** + *

Java class for anonymous complex type. + * + *

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

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="vnf-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="vf-module-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="vnf-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="vf-module-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="vnf-type" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="vf-module-model-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="asdc-service-model-version" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="service-instance-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="backout-on-failure" type="{http://www.w3.org/2001/XMLSchema}Boolean"/>
+ *         <choice>
+ *         	<element name="service-type" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         	<element name="service-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         </choice>
+ *         <choice>
+ *         	<element name="aic-node-clli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *          <element name="aic-cloud-region" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         </choice>
+ *         <element name="tenant-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="prov-status" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="volume-group-name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="volume-group-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="persona-model-id" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
+ *         <element name="persona-model-version" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
+ *         <element name="is-base-vf-module" type="{http://www.w3.org/2001/XMLSchema}Boolean"/ minOccurs="0">
+ *         <element name="vnf-persona-model-id" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
+ *         <element name="vnf-persona-model-version" type="{http://www.w3.org/2001/XMLSchema}string"/ minOccurs="0">
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "vnfId", + "vfModuleId", + "vnfName", + "vfModuleName", + "vnfType", + "vfModuleModelName", + "asdcServiceModelVersion", + "serviceInstanceId", + "backoutOnFailure", + "serviceType", + "serviceId", + "aicNodeClli", + "aicCloudRegion", + "tenantId", + "provStatus", + "volumeGroupName", + "volumeGroupId", + // BEGIN - elements valid only on BPMN interface + "personaModelId", + "personaModelVersion", + "isBaseVfModule", + "vnfPersonaModelId", + "vnfPersonaModelVersion" + // END - elements valid only on BPMN interface +}) +@XmlRootElement(name = "vnf-inputs") +public class VnfInputs { + + @XmlElement(name = "vnf-id") + protected String vnfId; + @XmlElement(name = "vf-module-id") + protected String vfModuleId; + @XmlElement(name = "vnf-name") + protected String vnfName; + @XmlElement(name = "vf-module-name") + protected String vfModuleName; + @XmlElement(name = "vnf-type") + protected String vnfType; + @XmlElement(name = "vf-module-model-name") + protected String vfModuleModelName; + @XmlElement(name = "asdc-service-model-version") + protected String asdcServiceModelVersion; + @XmlElement(name = "service-instance-id") + protected String serviceInstanceId; + @XmlElement(name = "backout-on-failure") + protected Boolean backoutOnFailure; + @XmlElement(name = "service-type") + protected String serviceType; + @XmlElement(name = "service-id") + protected String serviceId; + @XmlElement(name = "aic-node-clli") + protected String aicNodeClli; + @XmlElement(name = "aic-cloud-region") + protected String aicCloudRegion; + @XmlElement(name = "tenant-id", required = true) + protected String tenantId; + @XmlElement(name = "prov-status") + protected String provStatus; + @XmlElement(name = "volume-group-name") + protected String volumeGroupName; + @XmlElement(name = "volume-group-id") + protected String volumeGroupId; + @XmlElement(name = "persona-model-id") + protected String personaModelId; + @XmlElement(name = "persona-model-version") + protected String personaModelVersion; + @XmlElement(name = "is-base-vf-module") + protected Boolean isBaseVfModule; + @XmlElement(name = "vnf-persona-model-id") + protected String vnfPersonaModelId; + @XmlElement(name = "vnf-persona-model-version") + protected String vnfPersonaModelVersion; + + /** + * Gets the value of the vnfId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfId() { + return vnfId; + } + + /** + * Sets the value of the vnfId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfId(String value) { + this.vnfId = value; + } + + /** + * Gets the value of the vnfName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfName() { + return vnfName; + } + + /** + * Sets the value of the vnfName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfName(String value) { + this.vnfName = value; + } + + /** + * Gets the value of the vnfType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfType() { + return vnfType; + } + + /** + * Sets the value of the vnfType property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfType(String value) { + this.vnfType = value; + } + + /** + * Gets the value of the serviceInstanceId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceInstanceId() { + return serviceInstanceId; + } + + /** + * Sets the value of the serviceInstanceId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceInstanceId(String value) { + this.serviceInstanceId = value; + } + + /** + * Gets the value of the serviceType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceType() { + return serviceType; + } + + /** + * Sets the value of the serviceType property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceType(String value) { + this.serviceType = value; + } + + /** + * Gets the value of the serviceId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServiceId() { + return serviceId; + } + + /** + * Sets the value of the serviceId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServiceId (String value) { + this.serviceId = value; + } + + + /** + * Gets the value of the aicNodeClli property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAicNodeClli() { + return aicNodeClli; + } + + /** + * Sets the value of the aicNodeClli property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAicNodeClli(String value) { + this.aicNodeClli = value; + } + + /** + * Gets the value of the aicCloudRegion property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAicCloudRegion() { + return aicCloudRegion; + } + + /** + * Sets the value of the aicCloudRegion property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAicCloudRegion(String value) { + this.aicCloudRegion = value; + } + + /** + * Gets the value of the tenantId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTenantId() { + return tenantId; + } + + /** + * Sets the value of the tenantId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTenantId(String value) { + this.tenantId = value; + } + + /** + * Gets the value of the provStatus property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getProvStatus() { + return provStatus; + } + + /** + * Sets the value of the provStatus property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setProvStatus(String value) { + this.provStatus = value; + } + + /** + * Gets the value of the volumeGroupName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVolumeGroupName() { + return volumeGroupName; + } + + /** + * Sets the value of the volumeGroupName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVolumeGroupName(String value) { + this.volumeGroupName = value; + } + + /** + * Gets the value of the volumeGroupId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVolumeGroupId() { + return volumeGroupId; + } + + /** + * Sets the value of the volumeGroupId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVolumeGroupId(String value) { + this.volumeGroupId = value; + } + + /** + * Gets the value of the vfModuleId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVfModuleId() { + return vfModuleId; + } + + /** + * Sets the value of the vfModuleId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVfModuleId(String value) { + this.vfModuleId = value; + } + + /** + * Gets the value of the vfModuleName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVfModuleName() { + return vfModuleName; + } + + /** + * Sets the value of the vfModuleName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVfModuleName(String value) { + this.vfModuleName = value; + } + + /** + * Gets the value of the vfModuleModelName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVfModuleModelName() { + return vfModuleModelName; + } + + /** + * Sets the value of the vfModuleModelName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVfModuleModelName(String value) { + this.vfModuleModelName = value; + } + + /** + * Gets the value of the asdcServiceModelVersion property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAsdcServiceModelVersion() { + return asdcServiceModelVersion; + } + + /** + * Sets the value of the asdcServiceModelVersion property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAsdcServiceModelVersion(String value) { + this.asdcServiceModelVersion = value; + } + + /** + * Gets the value of the backoutOnFailure property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean getBackoutOnFailure() { + return backoutOnFailure; + } + + /** + * Sets the value of the backoutOnFailure property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setBackoutOnFailure(Boolean value) { + this.backoutOnFailure = value; + } + + /** + * Gets the value of the personaModelId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPersonaModelId() { + return personaModelId; + } + + /** + * Sets the value of the personaModelId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPersonaModelId(String value) { + this.personaModelId = value; + } + + /** + * Gets the value of the personaModelVersion property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPersonaModelVersion() { + return personaModelVersion; + } + + /** + * Sets the value of the personaModelVersion property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPersonaModelVersion(String value) { + this.personaModelVersion = value; + } + + + /** + * Gets the value of the isBaseVfModule property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean getIsBaseVfModule() { + return isBaseVfModule; + } + + /** + * Sets the value of the isBaseVfModule property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setIsBaseVfModule(Boolean value) { + this.isBaseVfModule = value; + } + + /** + * Gets the value of the vnfPersonaModelId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfPersonaModelId() { + return vnfPersonaModelId; + } + + /** + * Sets the value of the vnfPersonaModelId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfPersonaModelId(String value) { + this.vnfPersonaModelId = value; + } + + /** + * Gets the value of the vnfPersonaModelVersion property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfPersonaModelVersion() { + return vnfPersonaModelVersion; + } + + /** + * Sets the value of the vnfPersonaModelVersion property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfPersonaModelVersion(String value) { + this.vnfPersonaModelVersion = value; + } + + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + + +package org.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; + + +/** + *

Java class for anonymous complex type. + * + *

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

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="vnf-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="vf-module-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="vnf-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="vf-module-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="aic-node-clli" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="tenant-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="volume-group-name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="volume-group-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "vnfId", + "vfModuleId", + "vnfName", + "vfModuleName", + "aicNodeClli", + "tenantId", + "volumeGroupName", + "volumeGroupId" +}) +@XmlRootElement(name = "vnf-outputs") +public class VnfOutputs { + + @XmlElement(name = "vnf-id", required = true) + protected String vnfId; + @XmlElement(name = "vf-module-id") + protected String vfModuleId; + @XmlElement(name = "vnf-name", required = true) + protected String vnfName; + @XmlElement(name = "vf-module-name", required = true) + protected String vfModuleName; + @XmlElement(name = "aic-node-clli", required = true) + protected String aicNodeClli; + @XmlElement(name = "tenant-id", required = true) + protected String tenantId; + @XmlElement(name = "volume-group-name") + protected String volumeGroupName; + @XmlElement(name = "volume-group-id") + protected String volumeGroupId; + + /** + * Gets the value of the vnfId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfId() { + return vnfId; + } + + /** + * Sets the value of the vnfId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfId(String value) { + this.vnfId = value; + } + + /** + * Gets the value of the vfModuleId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVfModuleId() { + return vfModuleId; + } + + /** + * Sets the value of the vfModuleId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVfModuleId(String value) { + this.vfModuleId = value; + } + + + + /** + * Gets the value of the vnfName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfName() { + return vnfName; + } + + /** + * Sets the value of the vnfName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfName(String value) { + this.vnfName = value; + } + + /** + * Gets the value of the vfModuleName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVfModuleName() { + return vfModuleName; + } + + /** + * Sets the value of the vfModuleName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVfModuleName(String value) { + this.vfModuleName = value; + } + + + /** + * Gets the value of the aicNodeClli property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAicNodeClli() { + return aicNodeClli; + } + + /** + * Sets the value of the aicNodeClli property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAicNodeClli(String value) { + this.aicNodeClli = value; + } + + /** + * Gets the value of the tenantId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTenantId() { + return tenantId; + } + + /** + * Sets the value of the tenantId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTenantId(String value) { + this.tenantId = value; + } + + /** + * Gets the value of the volumeGroupName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVolumeGroupName() { + return volumeGroupName; + } + + /** + * Sets the value of the volumeGroupName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVolumeGroupName(String value) { + this.volumeGroupName = value; + } + + /** + * Gets the value of the volumeGroupId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVolumeGroupId() { + return volumeGroupId; + } + + /** + * Sets the value of the volumeGroupId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVolumeGroupId(String value) { + this.volumeGroupId = value; + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + + +package org.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; + + +/** + *

Java class for anonymous complex type. + * + *

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

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element ref="{http://org.onap/so/infra/vnf-request/v1}request-info"/>
+ *           <sequence>
+ *             <element ref="{http://org.onap/so/infra/vnf-request/v1}vnf-inputs"/>
+ *             <element ref="{http://org.onap/so/infra/vnf-request/v1}vnf-params" minOccurs="0"/>
+ *             <element ref="{http://org.onap/so/infra/vnf-request/v1}vnf-outputs" minOccurs="0"/>
+ *           </sequence>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "requestInfo", + "vnfInputs", + "vnfParams", + "vnfOutputs" +}) +@XmlRootElement(name = "vnf-request") +public class VnfRequest { + + @XmlElement(name = "request-info", required = true) + protected RequestInfo requestInfo; + @XmlElement(name = "vnf-inputs") + protected VnfInputs vnfInputs; + @XmlElement(name = "vnf-params") + protected Object vnfParams; + @XmlElement(name = "vnf-outputs") + protected VnfOutputs vnfOutputs; + + + /** + * Gets the value of the requestInfo property. + * + * @return + * possible object is + * {@link RequestInfo } + * + */ + public RequestInfo getRequestInfo() { + return requestInfo; + } + + /** + * Sets the value of the requestInfo property. + * + * @param value + * allowed object is + * {@link RequestInfo } + * + */ + public void setRequestInfo(RequestInfo value) { + this.requestInfo = value; + } + + /** + * Gets the value of the vnfInputs property. + * + * @return + * possible object is + * {@link VnfInputs } + * + */ + public VnfInputs getVnfInputs() { + return vnfInputs; + } + + /** + * Sets the value of the vnfInputs property. + * + * @param value + * allowed object is + * {@link VnfInputs } + * + */ + public void setVnfInputs(VnfInputs value) { + this.vnfInputs = value; + } + + /** + * Gets the value of the vnfParams property. + * + * @return + * possible object is + * {@link Object } + * + */ + public Object getVnfParams() { + return vnfParams; + } + + /** + * Sets the value of the vnfParams property. + * + * @param value + * allowed object is + * {@link Object } + * + */ + public void setVnfParams(Object value) { + this.vnfParams = value; + } + + /** + * Gets the value of the vnfOutputs property. + * + * @return + * possible object is + * {@link VnfOutputs } + * + */ + public VnfOutputs getVnfOutputs() { + return vnfOutputs; + } + + /** + * Sets the value of the vnfOutputs property. + * + * @param value + * allowed object is + * {@link VnfOutputs } + * + */ + public void setVnfOutputs(VnfOutputs value) { + this.vnfOutputs = value; + } + + } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + + +package org.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; + + +/** + *

Java class for anonymous complex type. + * + *

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

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

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

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

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

+ * Objects of the following type(s) are allowed in the list + * {@link VnfRequest } + * + * + */ + public List getVnfRequest() { + if (vnfRequest == null) { + vnfRequest = new ArrayList<>(); + } + return this.vnfRequest; + } + + public void setVnfRequest(List vnfRequest) { + this.vnfRequest=vnfRequest; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + + +package org.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; + + +/** + *

Java class for anonymous complex type. + * + *

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

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="type" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "type", + "id", + "description" +}) +@XmlRootElement(name = "vnf-type") +public class VnfType { + + @XmlElement(required = true) + protected String type; + @XmlElement(required = true) + protected String id; + @XmlElement(required = true) + protected String description; + + /** + * Gets the value of the type property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Sets the value of the type property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + + /** + * Gets the value of the id property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + /** + * Gets the value of the description property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescription() { + return description; + } + + /** + * Sets the value of the description property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescription(String value) { + this.description = value; + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/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 http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT +// + + +package org.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; + + +/** + *

Java class for anonymous complex type. + * + *

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

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

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

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

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

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

- *

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

- *

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

Java class for action-type. - * - *

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

- *

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

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

Java class for anonymous complex type. - * - *

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

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

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

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

- *

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

Java class for anonymous complex type. - * - *

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

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

Java class for anonymous complex type. - * - *

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

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

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

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

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

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

Java class for anonymous complex type. - * - *

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

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

Java class for anonymous complex type. - * - *

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

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

Java class for anonymous complex type. - * - *

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

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

Java class for anonymous complex type. - * - *

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

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

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

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

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

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

Java class for anonymous complex type. - * - *

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

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

Java class for anonymous complex type. - * - *

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

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

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

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

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

- * Objects of the following type(s) are allowed in the list - * {@link VnfType } - * - * - */ - public List getVnfType() { - if (vnfType == null) { - vnfType = new ArrayList<>(); - } - return this.vnfType; - } - - public void setVnfType(List vnfType) { - this.vnfType = vnfType; - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java deleted file mode 100644 index eb073e2fd0..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT -// - -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/mso/infra/vnf-request/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package org.openecomp.mso.apihandlerinfra.vnfbeans; - diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/ManualTasks.xsd b/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/ManualTasks.xsd deleted file mode 100644 index e8c67dddd7..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/ManualTasks.xsd +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/application.properties b/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/application.properties deleted file mode 100644 index 96c9e6fa18..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/resources/application.properties +++ /dev/null @@ -1,27 +0,0 @@ -### -# ============LICENSE_START======================================================= -# ECOMP MSO -# ================================================================================ -# 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========================================================= -### - -# -- welcome -- -welcomeTitle=JSF Blank Application - -welcomeHeading=Welcome! - -welcomeMessage=This is a JSF blank application. \ - You can find the application.properties file with this message in the src/resources folder. diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.onap.so.client.RestProperties new file mode 100644 index 0000000000..27ce09d118 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.onap.so.client.RestProperties @@ -0,0 +1 @@ +org.onap.so.apihandlerinfra.tenantisolation.AaiClientPropertiesImpl \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties new file mode 100644 index 0000000000..06f2419060 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.onap.so.client.dmaap.DmaapProperties @@ -0,0 +1 @@ +org.onap.so.apihandlerinfra.tenantisolation.dmaap.DmaapPropertiesImpl \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.onap.so.client.grm.GRMProperties b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.onap.so.client.grm.GRMProperties new file mode 100644 index 0000000000..58252e9be0 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.onap.so.client.grm.GRMProperties @@ -0,0 +1 @@ +org.onap.so.apihandlerinfra.tenantisolation.GrmClientPropertiesImpl \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties deleted file mode 100644 index 708fe0e8b5..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties +++ /dev/null @@ -1 +0,0 @@ -org.openecomp.mso.apihandlerinfra.tenantisolation.AaiClientPropertiesImpl \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties deleted file mode 100644 index 27c53a4e2e..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties +++ /dev/null @@ -1 +0,0 @@ -org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap.DmaapPropertiesImpl \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.grm.GRMProperties b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.grm.GRMProperties deleted file mode 100644 index bef20d435b..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.grm.GRMProperties +++ /dev/null @@ -1 +0,0 @@ -org.openecomp.mso.apihandlerinfra.tenantisolation.GrmClientPropertiesImpl \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml new file mode 100644 index 0000000000..3252146bfa --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml @@ -0,0 +1,160 @@ +# will be used as entry in DB to say SITE OFF/ON for healthcheck + +server: + port: 8080 + tomcat: + max-threads: 50 +ssl-enable: false + +apih-healthcheck-urn: /ecomp/mso/healthcheck,/ecomp/mso/homing/healthcheck,/ecomp/mso/infra/healthcheck,/asdc/healthcheck,/dbadapters/healthcheck,/ecomp/mso/catalog/v2/healthcheck +jra-healthcheck-urn: /networks/rest/healthcheck,/adapters/rest/healthcheck,/vnfs/rest/healthcheck,/tenants/rest/healthcheck,/appc/rest/healthcheck,/workflows/messages/healthcheck +camunda-healthcheck-urn: /mso/healthcheck + +apih-nodehealthcheck-urn: /ecomp/mso/infra/nodehealthcheck +jra-nodehealthcheck-urn: /adapters/rest/nodehealthcheck +camunda-nodehealthcheck-urn: /mso/nodehealthcheck + + + +mso: + logPath: logs + site-name: mtanj + catalog: + db: + spring: + endpoint: "http://localhost:8080" + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + config: + path: /src/main/resources/ + infra: + default: + alacarte: + orchestrationUri: /mso/async/services/ALaCarteOrchestrator + recipeTimeout: 180 + testApi: VNF_API + service: + macro: + default: + testApi: GR_API + apih: + homing: + sdna: + url: http://localhost:8089/ + password: 4112B789E942B161228F7D5AFC654C0F + bpelURL: http://localhost:8080/ + bpelAuth: 786864AA53D0DCD881AED1154230C0C3058D58B9339D2EFB6193A0F0D82530E1 + camundaURL: http://localhost:8089/ + camundaAuth: F8E9452B55DDE4CCE77547B0E748105C54CF5EF1351B4E2CBAABF2981EFE776D + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + sdc: + client: + auth: F3473596C526938329DF877495B494DC374D1C4198ED3AD305EA3ADCBBDA1862 + activate: + instanceid: test + userid: cs0008 + endpoint: http://localhost:28090 + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + tenant: + isolation: + retry: + count: 3 + aai: + endpoint: http://localhost:28090 + auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 + grm: + endpoint: http://localhost:28090 + username: gmruser + password: test + so: + operational-environment: + dmaap: + username: testuser + password: VjR5NDcxSzA= + host: http://localhost:28090 + publisher: + topic: com.att.ecomp.mso.operationalEnvironmentEvent + +# controls what actions the infra API (APIH) allows sent in on REST request +vnf: + v1: + ApiAllowableActions: + v2: + ApiAllowableActions: + v3: + ApiAllowableActions: + +network: + v1: + ApiAllowableActions: + v2: + ApiAllowableActions: + v3: + ApiAllowableActions: + +volume: + v1: + ApiAllowableActions: + v2: + ApiAllowableActions: + v3: + ApiAllowableActions: + +# H2 +spring: + datasource: + url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + username: sa + password: sa + driver-class-name: org.h2.Driver + intialize: true + h2: + console: + enabled: true + path: /h2 + + jpa: + show-sql: true + hibernate: + dialect: org.hibernate.dialect.H2Dialect + ddl-auto: validate + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable_lazy_load_no_trans: true + jersey: + type: filter + security: + usercredentials: + - + username: sitecontrol + password: '$2a$12$VBUF.qBmeK1FNyO2MqTpD.P2M1tvlesZlhCkAjjHvF9hmYNVdMDmu' + role: SiteControl-Client + - + username: gui + password: '$2a$12$9Y4daXavh.oX5fz6t/e7TuCdj7EKW5B5ibqq425fN3/xpp0/Fhyti' + role: GUI-Client + - + username: infraportal + password: '$2a$12$IpUEhQijWTNbq0fGYVkA9upZrDvdIK6QfblIaKAiwi0vBQRE.C6Ri' + role: InfraPortal-Client + - + username: bpel + password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO' + role: BPEL-Client + - + username: mso_admin + password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' + role: ACTUATOR +request: + datasource: + url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + username: sa + password: sa + driver-class-name: org.h2.Driver + intialize: true + +#Actuator +management: + context-path: /manage \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml new file mode 100644 index 0000000000..52bf3ffb87 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml @@ -0,0 +1,70 @@ +# will be used as entry in DB to say SITE OFF/ON for healthcheck + +server: + port: 8443 + tomcat: + max-threads: 50 + +mso: + infra: + default: + versions: + apiMinorVersion: 0 + apiPatchVersion: 0 + service: + macro: + default: + testApi: GR_API + avpn: + bpel: + uri: /mso/async/services/AVPNWorkflowActionBB + timeout: 180 + camunda: + rest: + task: + uri: /sobpmnengine/task + + +spring: + datasource: + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb + username: ${DB_USERNAME} + password: ${DB_PASSWORD} + driver-class-name: org.mariadb.jdbc.Driver + dbcp2: + initial-size: 5 + max-total: 20 + validation-query: select 1 + test-on-borrow: true + + jpa: + show-sql: true + hibernate: + dialect: org.hibernate.dialect.MySQL5Dialect + ddl-auto: validate + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + jersey: + type: filter + +request: + datasource: + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb + username: ${DB_USERNAME} + password: ${DB_PASSWORD} + driver-class-name: org.mariadb.jdbc.Driver + dbcp2: + initial-size: 5 + max-total: 20 + validation-query: select 1 + test-on-borrow: true + +#Actuator +management: + context-path: /manage + metrics: + se-global-registry: false + export: + prometheus: + enabled: true # Whether exporting of metrics to Prometheus is enabled. + step: 1m # Step size (i.e. reporting frequency) to use. diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/index.html b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/index.html new file mode 100644 index 0000000000..803202a317 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/index.html @@ -0,0 +1,41 @@ + + + + SO API Handler + + + +

+ + + + + + + + + + + + + + + + + +
+ Visit our Swagger UI +
+ APIHandler Read me +
+ View Current Properties +
+ View Health +
+ View Metrics +
+ H2 Console +
+
+ + \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/index.html b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/index.html new file mode 100644 index 0000000000..b6ff8f3991 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/index.html @@ -0,0 +1,53 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Introduction

    +
  • +
  • +

    SO API Handler

    +
  • +
  • +

    SO API Handler utilizes RESTful interfaces to interact with consumer applications. The SO interface + is used to orchestrate VNFs, allow for manual task completion, and send vnf replace requests. + It contains both the SOServiceInstantiation API and SOManualTasks API.

    +
  • +
  • +

    SOServiceInstantiation API

    +
  • +
  • +

    The SOServiceInstantiation API handles service instance requests, and supports both macro and aLaCarte + orchestrations. Change management operations, activation and deactivation of service instances, and new + requests for configuration resources are handled by this API. This API is currently + set for version 6 ("v6") while also supporting versions 4 and 5 ("v4", "v5") minus additional "v6" features.

    +
  • +
  • +

    SOManualTasks API

    +
  • +
  • +

    The SOManualTasks API handles queries about open manual tasks. This API also accepts POST requests + containing information about how SO should proceed with handling the open tasks, and resolving the + errors. SOManualTasks API currently supports version 1 ("v1").

    +
  • +
+
+
+ + + diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/install.html b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/install.html new file mode 100644 index 0000000000..297a32074f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/install.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Install

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/jars.html b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/jars.html new file mode 100644 index 0000000000..8d5c12bda7 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/jars.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Jars

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/layout.html b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/layout.html new file mode 100644 index 0000000000..cf47ed6a52 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/layout.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Layout

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/logging.html b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/logging.html new file mode 100644 index 0000000000..af68c7c634 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/logging.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Logging

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/onaplogo.png b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/onaplogo.png new file mode 100644 index 0000000000..c6f6857a58 Binary files /dev/null and b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/onaplogo.png differ diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/packaging.html b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/packaging.html new file mode 100644 index 0000000000..a72542c968 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/packaging.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Packaging

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/page.html b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/page.html new file mode 100644 index 0000000000..6302bc3509 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/page.html @@ -0,0 +1,70 @@ + + + + + + + \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/readme.css b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/readme.css new file mode 100644 index 0000000000..68963ba3ad --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/readme.css @@ -0,0 +1,114 @@ +html, body{ + margin:0; + padding:0; + height:100%; +} +div#page-wrapper{ + width: 991px; + min-height: 100%; + margin: auto; + border-style: solid; + border-width: thin; + border-color: #d0d6e0; + position: relative; +} +body{ + display:none; +} +nav#header{ + padding: 10px; + width: 972px; + height: 101.8px; + border-bottom: 1px solid #d0d6e0; + text-align: left; +} +nav#header ul{ + padding-left: 0px; + list-style-type: none; +} +nav#header a{ + color: #008080; + text-decoration: none; +} +nav#header a:hover{ + text-decoration: underline; +} +nav#left-col{ + position: absolute; + left: 0; + width: 248px; + padding-bottom: 35px; +} +nav#left-col ul{ + padding-left: 10px; + list-style-type: none; +} +.pages { + color: #008080; + text-decoration: none; + text-align: left; + font-size: 18px; +} +.sub-bullet a{ + text-decoration: none; + text-align: left; + font-size: 14px; + color: black; +} +.sub-bullet a:hover{ + text-decoration: underline; +} +div#right-col{ + padding-left: 150px; + padding-bottom: 35px; + padding-right: 50px; +} +.title{ + color: #008080; + font-size: 24px; + list-style-type: none; +} +.info-title{ + color: black; + font-size: 18px; + list-style-type: none; +} +.info{ + color: grey; + font-size: 14px; + list-style-type: none; +} +.info-list{ + list-style-position:inside; + font-size: 14px; + color: grey; + position: relative; + padding-bottom: 5px; +} +.info-sublist{ + list-style-position:inside; + font-size: 14px; + color: grey; + position: relative; + padding-bottom: 5px; + padding-left: 45px; +} +div#footer-wrapper{ + position: absolute; + bottom: 0; + width: 981px; + height: 35px; + background-color: #008080; + color: white; + font-size:15px; + text-align:right; + padding-right:10px; +} +div#footer-wrapper a{ + color: white; + text-align:right; + text-decoration:none; +} +div#footer-wrapper a:hover{ + text-decoration: underline; +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/spring.html b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/spring.html new file mode 100644 index 0000000000..c6e2b46710 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/spring.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Spring

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/testing.html b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/testing.html new file mode 100644 index 0000000000..7b558d940f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/testing.html @@ -0,0 +1,42 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Testing

    +
  • +
  • +

    JUnitParams: JUnit Parameterized Tests

    +
  • +
  • +

    Using JUnitParams allows for the inclusion of tests running with multiple sets of parameters. A class utilizing + JUnitParams will specify @RunWith(JUnitParamsRunner.class) above the class declaration. To indicate that a test will + be using sets of parameters, include the annotation: @Parameters(method = "nameOfMethodContainingParameters").

    +
  • +
  • +

    The test method signature includes the order of the parameters that it will be receiving; it will run with + each set of parameters provided to it. The method containing the sets of parameters to be sent to the test method is + indicated using the annotation: @Parameters. This method will return a collection of objects that is passed to the + test method.

    +
  • +
+
+
+ + + diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/tools.html b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/tools.html new file mode 100644 index 0000000000..b1813db387 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/readme/tools.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Tools

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/favicon-16x16.png b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/favicon-16x16.png new file mode 100644 index 0000000000..0f7e13b0d9 Binary files /dev/null and b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/favicon-16x16.png differ diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/favicon-32x32.png b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/favicon-32x32.png new file mode 100644 index 0000000000..b0a3352ffd Binary files /dev/null and b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/favicon-32x32.png differ diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/index.html b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/index.html new file mode 100644 index 0000000000..55740b0395 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/index.html @@ -0,0 +1,95 @@ + + + + + + Swagger UI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/oauth2-redirect.html b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/oauth2-redirect.html new file mode 100644 index 0000000000..eb00dc686a --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/oauth2-redirect.html @@ -0,0 +1,60 @@ + + + + + + diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/swagger-ui-bundle.js b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/swagger-ui-bundle.js new file mode 100644 index 0000000000..50ac4c2e40 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/static/swagger/swagger-ui-bundle.js @@ -0,0 +1,99 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SwaggerUIBundle=t():e.SwaggerUIBundle=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist",t(t.s=1139)}([function(e,t,n){"use strict";e.exports=n(86)},function(e,t,n){e.exports=n(923)()},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(312),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(){function e(e,t){for(var n=0;n>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?d(e)+t:t}function v(){return!0}function g(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function y(e,t){return b(e,t,0)}function _(e,t){return b(e,t,t)}function b(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}function x(e){this.next=e}function k(e,t,n,r){var i=0===e?t:1===e?n:[t,n];return r?r.value=i:r={value:i,done:!1},r}function w(){return{value:void 0,done:!0}}function E(e){return!!A(e)}function S(e){return e&&"function"==typeof e.next}function C(e){var t=A(e);return t&&t.call(e)}function A(e){var t=e&&(kn&&e[kn]||e[wn]);if("function"==typeof t)return t}function D(e){return e&&"number"==typeof e.length}function O(e){return null===e||void 0===e?j():o(e)?e.toSeq():z(e)}function T(e){return null===e||void 0===e?j().toKeyedSeq():o(e)?a(e)?e.toSeq():e.fromEntrySeq():L(e)}function M(e){return null===e||void 0===e?j():o(e)?a(e)?e.entrySeq():e.toIndexedSeq():q(e)}function P(e){return(null===e||void 0===e?j():o(e)?a(e)?e.entrySeq():e:q(e)).toSetSeq()}function I(e){this._array=e,this.size=e.length}function F(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function N(e){this._iterable=e,this.size=e.length||e.size}function R(e){this._iterator=e,this._iteratorCache=[]}function B(e){return!(!e||!e[Sn])}function j(){return Cn||(Cn=new I([]))}function L(e){var t=Array.isArray(e)?new I(e).fromEntrySeq():S(e)?new R(e).fromEntrySeq():E(e)?new N(e).fromEntrySeq():"object"==typeof e?new F(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function q(e){var t=U(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function z(e){var t=U(e)||"object"==typeof e&&new F(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}function U(e){return D(e)?new I(e):S(e)?new R(e):E(e)?new N(e):void 0}function W(e,t,n,r){var i=e._cache;if(i){for(var o=i.length-1,a=0;a<=o;a++){var s=i[n?o-a:a];if(!1===t(s[1],r?s[0]:a,e))return a+1}return a}return e.__iterateUncached(t,n)}function V(e,t,n,r){var i=e._cache;if(i){var o=i.length-1,a=0;return new x(function(){var e=i[n?o-a:a];return a++>o?w():k(t,r?e[0]:a-1,e[1])})}return e.__iteratorUncached(t,n)}function H(e,t){return t?G(t,e,"",{"":e}):J(e)}function G(e,t,n,r){return Array.isArray(t)?e.call(r,n,M(t).map(function(n,r){return G(e,n,r,t)})):X(t)?e.call(r,n,T(t).map(function(n,r){return G(e,n,r,t)})):t}function J(e){return Array.isArray(e)?M(e).map(J).toList():X(e)?T(e).map(J).toMap():e}function X(e){return e&&(e.constructor===Object||void 0===e.constructor)}function K(e,t){if(e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if(e=e.valueOf(),t=t.valueOf(),e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function Y(e,t){if(e===t)return!0;if(!o(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||a(e)!==a(t)||s(e)!==s(t)||l(e)!==l(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!u(e);if(l(e)){var r=e.entries();return t.every(function(e,t){var i=r.next().value;return i&&K(i[1],e)&&(n||K(i[0],t))})&&r.next().done}var i=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{i=!0;var c=e;e=t,t=c}var p=!0,f=t.__iterate(function(t,r){if(n?!e.has(t):i?!K(t,e.get(r,vn)):!K(e.get(r,vn),t))return p=!1,!1});return p&&e.size===f}function $(e,t){if(!(this instanceof $))return new $(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(An)return An;An=this}}function Z(e,t){if(!e)throw new Error(t)}function Q(e,t,n){if(!(this instanceof Q))return new Q(e,t,n);if(Z(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),t>>1&1073741824|3221225471&e}function oe(e){if(!1===e||null===e||void 0===e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null===e||void 0===e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!==e||e===1/0)return 0;var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)e/=4294967295,n^=e;return ie(n)}if("string"===t)return e.length>Rn?ae(e):se(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return ue(e);if("function"==typeof e.toString)return se(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function ae(e){var t=Ln[e];return void 0===t&&(t=se(e),jn===Bn&&(jn=0,Ln={}),jn++,Ln[e]=t),t}function se(e){for(var t=0,n=0;n0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}function ce(e){Z(e!==1/0,"Cannot perform this action with an infinite size.")}function pe(e){return null===e||void 0===e?ke():fe(e)&&!l(e)?e:ke().withMutations(function(t){var r=n(e);ce(r.size),r.forEach(function(e,n){return t.set(n,e)})})}function fe(e){return!(!e||!e[qn])}function he(e,t){this.ownerID=e,this.entries=t}function de(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function me(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function ve(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function ge(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function ye(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&be(e._root)}function _e(e,t){return k(e,t[0],t[1])}function be(e,t){return{node:e,index:0,__prev:t}}function xe(e,t,n,r){var i=Object.create(zn);return i.size=e,i._root=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function ke(){return Un||(Un=xe(0))}function we(e,t,n){var r,i;if(e._root){var o=c(gn),a=c(yn);if(r=Ee(e._root,e.__ownerID,0,void 0,t,n,o,a),!a.value)return e;i=e.size+(o.value?n===vn?-1:1:0)}else{if(n===vn)return e;i=1,r=new he(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=i,e._root=r,e.__hash=void 0,e.__altered=!0,e):r?xe(i,r):ke()}function Ee(e,t,n,r,i,o,a,s){return e?e.update(t,n,r,i,o,a,s):o===vn?e:(p(s),p(a),new ge(t,r,[i,o]))}function Se(e){return e.constructor===ge||e.constructor===ve}function Ce(e,t,n,r,i){if(e.keyHash===r)return new ve(t,r,[e.entry,i]);var o,a=(0===n?e.keyHash:e.keyHash>>>n)&mn,s=(0===n?r:r>>>n)&mn;return new de(t,1<>>=1)a[s]=1&n?t[o++]:void 0;return a[r]=i,new me(e,o+1,a)}function Te(e,t,r){for(var i=[],a=0;a>1&1431655765,e=(858993459&e)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function Re(e,t,n,r){var i=r?e:h(e);return i[t]=n,i}function Be(e,t,n,r){var i=e.length+1;if(r&&t+1===i)return e[t]=n,e;for(var o=new Array(i),a=0,s=0;s0&&io?0:o-n,l=a-n;return l>dn&&(l=dn),function(){if(i===l)return Kn;var e=t?--l:i++;return r&&r[e]}}function i(e,r,i){var s,u=e&&e.array,l=i>o?0:o-i>>r,c=1+(a-i>>r);return c>dn&&(c=dn),function(){for(;;){if(s){var e=s();if(e!==Kn)return e;s=null}if(l===c)return Kn;var o=t?--c:l++;s=n(u&&u[o],r-hn,i+(o<=e.size||t<0)return e.withMutations(function(e){t<0?Ke(e,t).set(0,n):Ke(e,0,t+1).set(t,n)});t+=e._origin;var r=e._tail,i=e._root,o=c(yn);return t>=$e(e._capacity)?r=Ge(r,e.__ownerID,0,t,n,o):i=Ge(i,e.__ownerID,e._level,t,n,o),o.value?e.__ownerID?(e._root=i,e._tail=r,e.__hash=void 0,e.__altered=!0,e):We(e._origin,e._capacity,e._level,i,r):e}function Ge(e,t,n,r,i,o){var a=r>>>n&mn,s=e&&a0){var l=e&&e.array[a],c=Ge(l,t,n-hn,r,i,o);return c===l?e:(u=Je(e,t),u.array[a]=c,u)}return s&&e.array[a]===i?e:(p(o),u=Je(e,t),void 0===i&&a===u.array.length-1?u.array.pop():u.array[a]=i,u)}function Je(e,t){return t&&e&&t===e.ownerID?e:new ze(e?e.array.slice():[],t)}function Xe(e,t){if(t>=$e(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&mn],r-=hn;return n}}function Ke(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new f,i=e._origin,o=e._capacity,a=i+t,s=void 0===n?o:n<0?o+n:i+n;if(a===i&&s===o)return e;if(a>=s)return e.clear();for(var u=e._level,l=e._root,c=0;a+c<0;)l=new ze(l&&l.array.length?[void 0,l]:[],r),u+=hn,c+=1<=1<p?new ze([],r):d;if(d&&h>p&&ahn;g-=hn){var y=p>>>g&mn;v=v.array[y]=Je(v.array[y],r)}v.array[p>>>hn&mn]=d}if(s=h)a-=h,s-=h,u=hn,l=null,m=m&&m.removeBefore(r,0,a);else if(a>i||h>>u&mn;if(_!==h>>>u&mn)break;_&&(c+=(1<i&&(l=l.removeBefore(r,u,a-c)),l&&ha&&(a=l.size),o(u)||(l=l.map(function(e){return H(e)})),i.push(l)}return a>e.size&&(e=e.setSize(a)),Ie(e,t,i)}function $e(e){return e>>hn<=dn&&a.size>=2*o.size?(i=a.filter(function(e,t){return void 0!==e&&s!==t}),r=i.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=i.__ownerID=e.__ownerID)):(r=o.remove(t),i=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(n===a.get(s)[1])return e;r=o,i=a.set(s,[t,n])}else r=o.set(t,a.size),i=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=i,e.__hash=void 0,e):et(r,i)}function rt(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function it(e){this._iter=e,this.size=e.size}function ot(e){this._iter=e,this.size=e.size}function at(e){this._iter=e,this.size=e.size}function st(e){var t=Dt(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=Ot,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return!1!==t(n,e,r)},n)},t.__iteratorUncached=function(t,n){if(t===xn){var r=e.__iterator(t,n);return new x(function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===bn?_n:bn,n)},t}function ut(e,t,n){var r=Dt(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,i){var o=e.get(r,vn);return o===vn?i:t.call(n,o,r,e)},r.__iterateUncached=function(r,i){var o=this;return e.__iterate(function(e,i,a){return!1!==r(t.call(n,e,i,a),i,o)},i)},r.__iteratorUncached=function(r,i){var o=e.__iterator(xn,i);return new x(function(){var i=o.next();if(i.done)return i;var a=i.value,s=a[0];return k(r,s,t.call(n,a[1],s,e),i)})},r}function lt(e,t){var n=Dt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=st(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=Ot,n.__iterate=function(t,n){var r=this;return e.__iterate(function(e,n){return t(e,n,r)},!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function ct(e,t,n,r){var i=Dt(e);return r&&(i.has=function(r){var i=e.get(r,vn);return i!==vn&&!!t.call(n,i,r,e)},i.get=function(r,i){var o=e.get(r,vn);return o!==vn&&t.call(n,o,r,e)?o:i}),i.__iterateUncached=function(i,o){var a=this,s=0;return e.__iterate(function(e,o,u){if(t.call(n,e,o,u))return s++,i(e,r?o:s-1,a)},o),s},i.__iteratorUncached=function(i,o){var a=e.__iterator(xn,o),s=0;return new x(function(){for(;;){var o=a.next();if(o.done)return o;var u=o.value,l=u[0],c=u[1];if(t.call(n,c,l,e))return k(i,r?l:s++,c,o)}})},i}function pt(e,t,n){var r=pe().asMutable();return e.__iterate(function(i,o){r.update(t.call(n,i,o,e),0,function(e){return e+1})}),r.asImmutable()}function ft(e,t,n){var r=a(e),i=(l(e)?Ze():pe()).asMutable();e.__iterate(function(o,a){i.update(t.call(n,o,a,e),function(e){return e=e||[],e.push(r?[a,o]:o),e})});var o=At(e);return i.map(function(t){return Et(e,o(t))})}function ht(e,t,n,r){var i=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n===1/0?n=i:n|=0),g(t,n,i))return e;var o=y(t,i),a=_(n,i);if(o!==o||a!==a)return ht(e.toSeq().cacheResult(),t,n,r);var s,u=a-o;u===u&&(s=u<0?0:u);var l=Dt(e);return l.size=0===s?s:e.size&&s||void 0,!r&&B(e)&&s>=0&&(l.get=function(t,n){return t=m(this,t),t>=0&&ts)return w();var e=i.next();return r||t===bn?e:t===_n?k(t,u-1,void 0,e):k(t,u-1,e.value[1],e)})},l}function dt(e,t,n){var r=Dt(e);return r.__iterateUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterate(r,i);var a=0;return e.__iterate(function(e,i,s){return t.call(n,e,i,s)&&++a&&r(e,i,o)}),a},r.__iteratorUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterator(r,i);var a=e.__iterator(xn,i),s=!0;return new x(function(){if(!s)return w();var e=a.next();if(e.done)return e;var i=e.value,u=i[0],l=i[1];return t.call(n,l,u,o)?r===xn?e:k(r,u,l,e):(s=!1,w())})},r}function mt(e,t,n,r){var i=Dt(e);return i.__iterateUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterate(i,o);var s=!0,u=0;return e.__iterate(function(e,o,l){if(!s||!(s=t.call(n,e,o,l)))return u++,i(e,r?o:u-1,a)}),u},i.__iteratorUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterator(i,o);var s=e.__iterator(xn,o),u=!0,l=0;return new x(function(){var e,o,c;do{if(e=s.next(),e.done)return r||i===bn?e:i===_n?k(i,l++,void 0,e):k(i,l++,e.value[1],e);var p=e.value;o=p[0],c=p[1],u&&(u=t.call(n,c,o,a))}while(u);return i===xn?e:k(i,o,c,e)})},i}function vt(e,t){var r=a(e),i=[e].concat(t).map(function(e){return o(e)?r&&(e=n(e)):e=r?L(e):q(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===i.length)return e;if(1===i.length){var u=i[0];if(u===e||r&&a(u)||s(e)&&s(u))return u}var l=new I(i);return r?l=l.toKeyedSeq():s(e)||(l=l.toSetSeq()),l=l.flatten(!0),l.size=i.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),l}function gt(e,t,n){var r=Dt(e);return r.__iterateUncached=function(r,i){function a(e,l){var c=this;e.__iterate(function(e,i){return(!t||l0}function wt(e,n,r){var i=Dt(e);return i.size=new I(r).map(function(e){return e.size}).min(),i.__iterate=function(e,t){for(var n,r=this.__iterator(bn,t),i=0;!(n=r.next()).done&&!1!==e(n.value,i++,this););return i},i.__iteratorUncached=function(e,i){var o=r.map(function(e){return e=t(e),C(i?e.reverse():e)}),a=0,s=!1;return new x(function(){var t;return s||(t=o.map(function(e){return e.next()}),s=t.some(function(e){return e.done})),s?w():k(e,a++,n.apply(null,t.map(function(e){return e.value})))})},i}function Et(e,t){return B(e)?t:e.constructor(t)}function St(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Ct(e){return ce(e.size),d(e)}function At(e){return a(e)?n:s(e)?r:i}function Dt(e){return Object.create((a(e)?T:s(e)?M:P).prototype)}function Ot(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):O.prototype.cacheResult.call(this)}function Tt(e,t){return e>t?1:et?-1:0}function on(e){if(e.size===1/0)return 0;var t=l(e),n=a(e),r=t?1:0;return an(e.__iterate(n?t?function(e,t){r=31*r+sn(oe(e),oe(t))|0}:function(e,t){r=r+sn(oe(e),oe(t))|0}:t?function(e){r=31*r+oe(e)|0}:function(e){r=r+oe(e)|0}),r)}function an(e,t){return t=Tn(t,3432918353),t=Tn(t<<15|t>>>-15,461845907),t=Tn(t<<13|t>>>-13,5),t=(t+3864292196|0)^e,t=Tn(t^t>>>16,2246822507),t=Tn(t^t>>>13,3266489909),t=ie(t^t>>>16)}function sn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}var un=Array.prototype.slice;e(n,t),e(r,t),e(i,t),t.isIterable=o,t.isKeyed=a,t.isIndexed=s,t.isAssociative=u,t.isOrdered=l,t.Keyed=n,t.Indexed=r,t.Set=i;var ln="@@__IMMUTABLE_ITERABLE__@@",cn="@@__IMMUTABLE_KEYED__@@",pn="@@__IMMUTABLE_INDEXED__@@",fn="@@__IMMUTABLE_ORDERED__@@",hn=5,dn=1<r?w():k(e,i,n[t?r-i++:i++])})},e(F,T),F.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},F.prototype.has=function(e){return this._object.hasOwnProperty(e)},F.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,i=r.length-1,o=0;o<=i;o++){var a=r[t?i-o:o];if(!1===e(n[a],a,this))return o+1}return o},F.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,i=r.length-1,o=0;return new x(function(){var a=r[t?i-o:o];return o++>i?w():k(e,a,n[a])})},F.prototype[fn]=!0,e(N,M),N.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterable,r=C(n),i=0;if(S(r))for(var o;!(o=r.next()).done&&!1!==e(o.value,i++,this););return i},N.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterable,r=C(n);if(!S(r))return new x(w);var i=0;return new x(function(){var t=r.next();return t.done?t:k(e,i++,t.value)})},e(R,M),R.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n=this._iterator,r=this._iteratorCache,i=0;i=r.length){var t=n.next();if(t.done)return t;r[i]=t.value}return k(e,i,r[i++])})};var Cn;e($,M),$.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},$.prototype.get=function(e,t){return this.has(e)?this._value:t},$.prototype.includes=function(e){return K(this._value,e)},$.prototype.slice=function(e,t){var n=this.size;return g(e,t,n)?this:new $(this._value,_(t,n)-y(e,n))},$.prototype.reverse=function(){return this},$.prototype.indexOf=function(e){return K(this._value,e)?0:-1},$.prototype.lastIndexOf=function(e){return K(this._value,e)?this.size:-1},$.prototype.__iterate=function(e,t){for(var n=0;n=0&&t=0&&nn?w():k(e,o++,a)})},Q.prototype.equals=function(e){return e instanceof Q?this._start===e._start&&this._end===e._end&&this._step===e._step:Y(this,e)};var Dn;e(ee,t),e(te,ee),e(ne,ee),e(re,ee),ee.Keyed=te,ee.Indexed=ne,ee.Set=re;var On,Tn="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){e|=0,t|=0;var n=65535&e,r=65535&t;return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0},Mn=Object.isExtensible,Pn=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}(),In="function"==typeof WeakMap;In&&(On=new WeakMap);var Fn=0,Nn="__immutablehash__";"function"==typeof Symbol&&(Nn=Symbol(Nn));var Rn=16,Bn=255,jn=0,Ln={};e(pe,te),pe.of=function(){var e=un.call(arguments,0);return ke().withMutations(function(t){for(var n=0;n=e.length)throw new Error("Missing value for key: "+e[n]);t.set(e[n],e[n+1])}})},pe.prototype.toString=function(){return this.__toString("Map {","}")},pe.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},pe.prototype.set=function(e,t){return we(this,e,t)},pe.prototype.setIn=function(e,t){return this.updateIn(e,vn,function(){return t})},pe.prototype.remove=function(e){return we(this,e,vn)},pe.prototype.deleteIn=function(e){return this.updateIn(e,function(){return vn})},pe.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},pe.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);var r=Fe(this,Mt(e),t,n);return r===vn?void 0:r},pe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):ke()},pe.prototype.merge=function(){return Te(this,void 0,arguments)},pe.prototype.mergeWith=function(e){return Te(this,e,un.call(arguments,1))},pe.prototype.mergeIn=function(e){var t=un.call(arguments,1);return this.updateIn(e,ke(),function(e){return"function"==typeof e.merge?e.merge.apply(e,t):t[t.length-1]})},pe.prototype.mergeDeep=function(){return Te(this,Me,arguments)},pe.prototype.mergeDeepWith=function(e){var t=un.call(arguments,1);return Te(this,Pe(e),t)},pe.prototype.mergeDeepIn=function(e){var t=un.call(arguments,1);return this.updateIn(e,ke(),function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,t):t[t.length-1]})},pe.prototype.sort=function(e){return Ze(bt(this,e))},pe.prototype.sortBy=function(e,t){return Ze(bt(this,t,e))},pe.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},pe.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new f)},pe.prototype.asImmutable=function(){return this.__ensureOwner()},pe.prototype.wasAltered=function(){return this.__altered},pe.prototype.__iterator=function(e,t){return new ye(this,e,t)},pe.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate(function(t){return r++,e(t[1],t[0],n)},t),r},pe.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?xe(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},pe.isMap=fe;var qn="@@__IMMUTABLE_MAP__@@",zn=pe.prototype;zn[qn]=!0,zn.delete=zn.remove,zn.removeIn=zn.deleteIn,he.prototype.get=function(e,t,n,r){for(var i=this.entries,o=0,a=i.length;o=Wn)return Ae(e,u,r,i);var d=e&&e===this.ownerID,m=d?u:h(u);return f?s?l===c-1?m.pop():m[l]=m.pop():m[l]=[r,i]:m.push([r,i]),d?(this.entries=m,this):new he(e,m)}},de.prototype.get=function(e,t,n,r){void 0===t&&(t=oe(n));var i=1<<((0===e?t:t>>>e)&mn),o=this.bitmap;return 0==(o&i)?r:this.nodes[Ne(o&i-1)].get(e+hn,t,n,r)},de.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=oe(r));var s=(0===t?n:n>>>t)&mn,u=1<=Vn)return Oe(e,f,l,s,d);if(c&&!d&&2===f.length&&Se(f[1^p]))return f[1^p];if(c&&d&&1===f.length&&Se(d))return d;var m=e&&e===this.ownerID,v=c?d?l:l^u:l|u,g=c?d?Re(f,p,d,m):je(f,p,m):Be(f,p,d,m);return m?(this.bitmap=v,this.nodes=g,this):new de(e,v,g)},me.prototype.get=function(e,t,n,r){void 0===t&&(t=oe(n));var i=(0===e?t:t>>>e)&mn,o=this.nodes[i];return o?o.get(e+hn,t,n,r):r},me.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=oe(r));var s=(0===t?n:n>>>t)&mn,u=i===vn,l=this.nodes,c=l[s];if(u&&!c)return this;var p=Ee(c,e,t+hn,n,r,i,o,a);if(p===c)return this;var f=this.count;if(c){if(!p&&--f=0&&e>>t&mn;if(r>=this.array.length)return new ze([],e);var i,o=0===r;if(t>0){var a=this.array[r];if((i=a&&a.removeBefore(e,t-hn,n))===a&&o)return this}if(o&&!i)return this;var s=Je(this,e);if(!o)for(var u=0;u>>t&mn;if(r>=this.array.length)return this;var i;if(t>0){var o=this.array[r];if((i=o&&o.removeAfter(e,t-hn,n))===o&&r===this.array.length-1)return this}var a=Je(this,e);return a.array.splice(r+1),i&&(a.array[r]=i),a};var Xn,Kn={};e(Ze,pe),Ze.of=function(){return this(arguments)},Ze.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Ze.prototype.get=function(e,t){var n=this._map.get(e);return void 0!==n?this._list.get(n)[1]:t},Ze.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):tt()},Ze.prototype.set=function(e,t){return nt(this,e,t)},Ze.prototype.remove=function(e){return nt(this,e,vn)},Ze.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Ze.prototype.__iterate=function(e,t){var n=this;return this._list.__iterate(function(t){return t&&e(t[1],t[0],n)},t)},Ze.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},Ze.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),n=this._list.__ensureOwner(e);return e?et(t,n,e,this.__hash):(this.__ownerID=e,this._map=t,this._list=n,this)},Ze.isOrderedMap=Qe,Ze.prototype[fn]=!0,Ze.prototype.delete=Ze.prototype.remove;var Yn;e(rt,T),rt.prototype.get=function(e,t){return this._iter.get(e,t)},rt.prototype.has=function(e){return this._iter.has(e)},rt.prototype.valueSeq=function(){return this._iter.valueSeq()},rt.prototype.reverse=function(){var e=this,t=lt(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},rt.prototype.map=function(e,t){var n=this,r=ut(this,e,t);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(e,t)}),r},rt.prototype.__iterate=function(e,t){var n,r=this;return this._iter.__iterate(this._useKeys?function(t,n){return e(t,n,r)}:(n=t?Ct(this):0,function(i){return e(i,t?--n:n++,r)}),t)},rt.prototype.__iterator=function(e,t){if(this._useKeys)return this._iter.__iterator(e,t);var n=this._iter.__iterator(bn,t),r=t?Ct(this):0;return new x(function(){var i=n.next();return i.done?i:k(e,t?--r:r++,i.value,i)})},rt.prototype[fn]=!0,e(it,M),it.prototype.includes=function(e){return this._iter.includes(e)},it.prototype.__iterate=function(e,t){var n=this,r=0;return this._iter.__iterate(function(t){return e(t,r++,n)},t)},it.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t),r=0;return new x(function(){var t=n.next();return t.done?t:k(e,r++,t.value,t)})},e(ot,P),ot.prototype.has=function(e){return this._iter.includes(e)},ot.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){return e(t,t,n)},t)},ot.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t);return new x(function(){var t=n.next();return t.done?t:k(e,t.value,t.value,t)})},e(at,T),at.prototype.entrySeq=function(){return this._iter.toSeq()},at.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){if(t){St(t);var r=o(t);return e(r?t.get(1):t[1],r?t.get(0):t[0],n)}},t)},at.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t);return new x(function(){for(;;){var t=n.next();if(t.done)return t;var r=t.value;if(r){St(r);var i=o(r);return k(e,i?r.get(0):r[0],i?r.get(1):r[1],t)}}})},it.prototype.cacheResult=rt.prototype.cacheResult=ot.prototype.cacheResult=at.prototype.cacheResult=Ot,e(Pt,te),Pt.prototype.toString=function(){return this.__toString(Ft(this)+" {","}")},Pt.prototype.has=function(e){return this._defaultValues.hasOwnProperty(e)},Pt.prototype.get=function(e,t){if(!this.has(e))return t;var n=this._defaultValues[e];return this._map?this._map.get(e,n):n},Pt.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var e=this.constructor;return e._empty||(e._empty=It(this,ke()))},Pt.prototype.set=function(e,t){if(!this.has(e))throw new Error('Cannot set unknown key "'+e+'" on '+Ft(this));if(this._map&&!this._map.has(e)){if(t===this._defaultValues[e])return this}var n=this._map&&this._map.set(e,t);return this.__ownerID||n===this._map?this:It(this,n)},Pt.prototype.remove=function(e){if(!this.has(e))return this;var t=this._map&&this._map.remove(e);return this.__ownerID||t===this._map?this:It(this,t)},Pt.prototype.wasAltered=function(){return this._map.wasAltered()},Pt.prototype.__iterator=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterator(e,t)},Pt.prototype.__iterate=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterate(e,t)},Pt.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map&&this._map.__ensureOwner(e);return e?It(this,t,e):(this.__ownerID=e,this._map=t,this)};var $n=Pt.prototype;$n.delete=$n.remove,$n.deleteIn=$n.removeIn=zn.removeIn,$n.merge=zn.merge,$n.mergeWith=zn.mergeWith,$n.mergeIn=zn.mergeIn,$n.mergeDeep=zn.mergeDeep,$n.mergeDeepWith=zn.mergeDeepWith,$n.mergeDeepIn=zn.mergeDeepIn,$n.setIn=zn.setIn,$n.update=zn.update,$n.updateIn=zn.updateIn,$n.withMutations=zn.withMutations,$n.asMutable=zn.asMutable,$n.asImmutable=zn.asImmutable,e(Bt,re),Bt.of=function(){return this(arguments)},Bt.fromKeys=function(e){return this(n(e).keySeq())},Bt.prototype.toString=function(){return this.__toString("Set {","}")},Bt.prototype.has=function(e){return this._map.has(e)},Bt.prototype.add=function(e){return Lt(this,this._map.set(e,!0))},Bt.prototype.remove=function(e){return Lt(this,this._map.remove(e))},Bt.prototype.clear=function(){return Lt(this,this._map.clear())},Bt.prototype.union=function(){var e=un.call(arguments,0);return e=e.filter(function(e){return 0!==e.size}),0===e.length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations(function(t){for(var n=0;n=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):Xt(e,t)},Gt.prototype.pushAll=function(e){if(e=r(e),0===e.size)return this;ce(e.size);var t=this.size,n=this._head;return e.reverse().forEach(function(e){t++,n={value:e,next:n}}),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):Xt(t,n)},Gt.prototype.pop=function(){return this.slice(1)},Gt.prototype.unshift=function(){return this.push.apply(this,arguments)},Gt.prototype.unshiftAll=function(e){return this.pushAll(e)},Gt.prototype.shift=function(){return this.pop.apply(this,arguments)},Gt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Kt()},Gt.prototype.slice=function(e,t){if(g(e,t,this.size))return this;var n=y(e,this.size);if(_(t,this.size)!==this.size)return ne.prototype.slice.call(this,e,t);for(var r=this.size-n,i=this._head;n--;)i=i.next;return this.__ownerID?(this.size=r,this._head=i,this.__hash=void 0,this.__altered=!0,this):Xt(r,i)},Gt.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Xt(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},Gt.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},Gt.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new x(function(){if(r){var t=r.value;return r=r.next,k(e,n++,t)}return w()})},Gt.isStack=Jt;var rr="@@__IMMUTABLE_STACK__@@",ir=Gt.prototype;ir[rr]=!0,ir.withMutations=zn.withMutations,ir.asMutable=zn.asMutable,ir.asImmutable=zn.asImmutable,ir.wasAltered=zn.wasAltered;var or;t.Iterator=x,Yt(t,{toArray:function(){ce(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,n){e[n]=t}),e},toIndexedSeq:function(){return new it(this)},toJS:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJS?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new rt(this,!0)},toMap:function(){return pe(this.toKeyedSeq())},toObject:function(){ce(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e},toOrderedMap:function(){return Ze(this.toKeyedSeq())},toOrderedSet:function(){return Ut(a(this)?this.valueSeq():this)},toSet:function(){return Bt(a(this)?this.valueSeq():this)},toSetSeq:function(){return new ot(this)},toSeq:function(){return s(this)?this.toIndexedSeq():a(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Gt(a(this)?this.valueSeq():this)},toList:function(){return Le(a(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){return Et(this,vt(this,un.call(arguments,0)))},includes:function(e){return this.some(function(t){return K(t,e)})},entries:function(){return this.__iterator(xn)},every:function(e,t){ce(this.size);var n=!0;return this.__iterate(function(r,i,o){if(!e.call(t,r,i,o))return n=!1,!1}),n},filter:function(e,t){return Et(this,ct(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},forEach:function(e,t){return ce(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){ce(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate(function(r){n?n=!1:t+=e,t+=null!==r&&void 0!==r?r.toString():""}),t},keys:function(){return this.__iterator(_n)},map:function(e,t){return Et(this,ut(this,e,t))},reduce:function(e,t,n){ce(this.size);var r,i;return arguments.length<2?i=!0:r=t,this.__iterate(function(t,o,a){i?(i=!1,r=t):r=e.call(n,r,t,o,a)}),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return Et(this,lt(this,!0))},slice:function(e,t){return Et(this,ht(this,e,t,!0))},some:function(e,t){return!this.every(Qt(e),t)},sort:function(e){return Et(this,bt(this,e))},values:function(){return this.__iterator(bn)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(e,t){return d(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return pt(this,e,t)},equals:function(e){return Y(this,e)},entrySeq:function(){var e=this;if(e._cache)return new I(e._cache);var t=e.toSeq().map(Zt).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Qt(e),t)},findEntry:function(e,t,n){var r=n;return this.__iterate(function(n,i,o){if(e.call(t,n,i,o))return r=[i,n],!1}),r},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},findLastEntry:function(e,t,n){return this.toKeyedSeq().reverse().findEntry(e,t,n)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(){return this.find(v)},flatMap:function(e,t){return Et(this,yt(this,e,t))},flatten:function(e){return Et(this,gt(this,e,!0))},fromEntrySeq:function(){return new at(this)},get:function(e,t){return this.find(function(t,n){return K(n,e)},void 0,t)},getIn:function(e,t){for(var n,r=this,i=Mt(e);!(n=i.next()).done;){var o=n.value;if((r=r&&r.get?r.get(o,vn):vn)===vn)return t}return r},groupBy:function(e,t){return ft(this,e,t)},has:function(e){return this.get(e,vn)!==vn},hasIn:function(e){return this.getIn(e,vn)!==vn},isSubset:function(e){return e="function"==typeof e.includes?e:t(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return e="function"==typeof e.isSubset?e:t(e),e.isSubset(this)},keyOf:function(e){return this.findKey(function(t){return K(t,e)})},keySeq:function(){return this.toSeq().map($t).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return xt(this,e)},maxBy:function(e,t){return xt(this,t,e)},min:function(e){return xt(this,e?en(e):rn)},minBy:function(e,t){return xt(this,t?en(t):rn,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return Et(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return Et(this,mt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Qt(e),t)},sortBy:function(e,t){return Et(this,bt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return Et(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return Et(this,dt(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Qt(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=on(this))}});var ar=t.prototype;ar[ln]=!0,ar[En]=ar.values,ar.__toJS=ar.toArray,ar.__toStringMapper=tn,ar.inspect=ar.toSource=function(){return this.toString()},ar.chain=ar.flatMap,ar.contains=ar.includes,Yt(n,{flip:function(){return Et(this,st(this))},mapEntries:function(e,t){var n=this,r=0;return Et(this,this.toSeq().map(function(i,o){return e.call(t,[o,i],r++,n)}).fromEntrySeq())},mapKeys:function(e,t){var n=this;return Et(this,this.toSeq().flip().map(function(r,i){return e.call(t,r,i,n)}).flip())}});var sr=n.prototype;return sr[cn]=!0,sr[En]=ar.entries,sr.__toJS=ar.toObject,sr.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+tn(e)},Yt(r,{toKeyedSeq:function(){return new rt(this,!1)},filter:function(e,t){return Et(this,ct(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return Et(this,lt(this,!1))},slice:function(e,t){return Et(this,ht(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=y(e,e<0?this.count():this.size);var r=this.slice(0,e);return Et(this,1===n?r:r.concat(h(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.findLastEntry(e,t);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(e){return Et(this,gt(this,e,!1))},get:function(e,t){return e=m(this,e),e<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find(function(t,n){return n===e},void 0,t)},has:function(e){return(e=m(this,e))>=0&&(void 0!==this.size?this.size===1/0||e5e3)return e.textContent;return function(e){for(var n,r,i,o,a,s=e.textContent,u=0,l=s[0],c=1,p=e.innerHTML="",f=0;r=n,n=f<7&&"\\"==n?1:c;){if(c=l,l=s[++u],o=p.length>1,!c||f>8&&"\n"==c||[/\S/.test(c),1,1,!/[$\w]/.test(c),("/"==n||"\n"==n)&&o,'"'==n&&o,"'"==n&&o,s[u-4]+r+n=="--\x3e",r+n=="*/"][f])for(p&&(e.appendChild(a=t.createElement("span")).setAttribute("style",["color: #555; font-weight: bold;","","","color: #555;",""][f?f<3?2:f>6?4:f>3?3:+/^(a(bstract|lias|nd|rguments|rray|s(m|sert)?|uto)|b(ase|egin|ool(ean)?|reak|yte)|c(ase|atch|har|hecked|lass|lone|ompl|onst|ontinue)|de(bugger|cimal|clare|f(ault|er)?|init|l(egate|ete)?)|do|double|e(cho|ls?if|lse(if)?|nd|nsure|num|vent|x(cept|ec|p(licit|ort)|te(nds|nsion|rn)))|f(allthrough|alse|inal(ly)?|ixed|loat|or(each)?|riend|rom|unc(tion)?)|global|goto|guard|i(f|mp(lements|licit|ort)|n(it|clude(_once)?|line|out|stanceof|t(erface|ernal)?)?|s)|l(ambda|et|ock|ong)|m(icrolight|odule|utable)|NaN|n(amespace|ative|ext|ew|il|ot|ull)|o(bject|perator|r|ut|verride)|p(ackage|arams|rivate|rotected|rotocol|ublic)|r(aise|e(adonly|do|f|gister|peat|quire(_once)?|scue|strict|try|turn))|s(byte|ealed|elf|hort|igned|izeof|tatic|tring|truct|ubscript|uper|ynchronized|witch)|t(emplate|hen|his|hrows?|ransient|rue|ry|ype(alias|def|id|name|of))|u(n(checked|def(ined)?|ion|less|signed|til)|se|sing)|v(ar|irtual|oid|olatile)|w(char_t|hen|here|hile|ith)|xor|yield)$/.test(p):0]),a.appendChild(t.createTextNode(p))),i=f&&f<7?f:i,p="",f=11;![1,/[\/{}[(\-+*=<>:;|\\.,?!&@~]/.test(c),/[\])]/.test(c),/[$\w]/.test(c),"/"==c&&i<2&&"<"!=n,'"'==c,"'"==c,c+l+s[u+1]+s[u+2]=="\x3c!--",c+l=="/*",c+l=="//","#"==c][--f];);p+=c}}(e)}function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:j.default.Map();if(!j.default.Map.isMap(e)||!e.size)return j.default.List();if(Array.isArray(t)||(t=[t]),t.length<1)return e.merge(n);var r=j.default.List(),i=t[0],o=!0,a=!1,s=void 0;try{for(var u,l=(0,T.default)(e.entries());!(o=(u=l.next()).done);o=!0){var c=u.value,p=(0,D.default)(c,2),f=p[0],h=p[1],d=b(h,t.slice(1),n.set(i,f));r=j.default.List.isList(d)?r.concat(d):r.push(d)}}catch(e){a=!0,s=e}finally{try{!o&&l.return&&l.return()}finally{if(a)throw s}}return r}function x(e){return(0,W.default)((0,z.default)(e))}function k(e){return x(e.replace(/\.[^.\/]*$/,""))}function w(e){return"string"!=typeof e||""===e?"":(0,L.sanitizeUrl)(e)}function E(e){if(!j.default.OrderedMap.isOrderedMap(e))return null;if(!e.size)return null;var t=e.find(function(e,t){return t.startsWith("2")&&(0,F.default)(e.get("content")||{}).length>0}),n=e.get("default")||j.default.OrderedMap(),r=(n.get("content")||j.default.OrderedMap()).keySeq().toJS(),i=r.length?n:null;return t||i}Object.defineProperty(t,"__esModule",{value:!0}),t.escapeDeepLinkPath=t.createDeepLinkPath=t.shallowEqualKeys=t.buildFormData=t.sorters=t.btoa=t.parseSearch=t.getSampleSchema=t.validateParam=t.validatePattern=t.validateMinLength=t.validateMaxLength=t.validateGuid=t.validateDateTime=t.validateString=t.validateBoolean=t.validateFile=t.validateInteger=t.validateNumber=t.validateMinimum=t.validateMaximum=t.propChecker=t.errorLog=t.memoize=t.isImmutable=void 0;var S=n(42),C=r(S),A=n(16),D=r(A),O=n(89),T=r(O),M=n(31),P=r(M),I=n(49),F=r(I),N=n(43),R=r(N);t.isJSONObject=i,t.objectify=o,t.arrayify=a,t.fromJSOrdered=s,t.bindToState=u,t.normalizeArray=l,t.isFn=c,t.isObject=p,t.isFunc=f,t.isArray=h,t.objMap=d,t.objReduce=m,t.systemThunkMiddleware=v,t.defaultStatusCode=g,t.getList=y,t.highlight=_,t.mapToList=b,t.pascalCase=x,t.pascalCaseFilename=k,t.sanitizeUrl=w,t.getAcceptControllingResponse=E;var B=n(8),j=r(B),L=n(471),q=n(881),z=r(q),U=n(406),W=r(U),V=n(403),H=r(V),G=n(215),J=r(G),X=n(897),K=r(X),Y=n(113),$=r(Y),Z=n(161),Q=n(48),ee=r(Q),te=n(639),ne=r(te),re="default",ie=t.isImmutable=function(e){return j.default.Iterable.isIterable(e)},oe=(t.memoize=H.default,t.errorLog=function(e){return function(){return function(t){return function(n){try{t(n)}catch(t){e().errActions.newThrownErr(t,n)}}}}},t.propChecker=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return(0,F.default)(e).length!==(0,F.default)(t).length||((0,K.default)(e,function(e,n){if(r.includes(n))return!1;var i=t[n];return j.default.Iterable.isIterable(e)?!j.default.is(e,i):("object"!==(void 0===e?"undefined":(0,R.default)(e))||"object"!==(void 0===i?"undefined":(0,R.default)(i)))&&e!==i})||n.some(function(n){return!(0,$.default)(e[n],t[n])}))},t.validateMaximum=function(e,t){if(e>t)return"Value must be less than Maximum"}),ae=t.validateMinimum=function(e,t){if(et)return"Value must be less than MaxLength"},me=t.validateMinLength=function(e,t){if(e.length2&&void 0!==arguments[2]&&arguments[2],r=[],i=t&&"body"===e.get("in")?e.get("value_xml"):e.get("value"),o=e.get("required"),a=n?e.get("schema"):e,s=a.get("maximum"),u=a.get("minimum"),l=a.get("type"),c=a.get("format"),p=a.get("maxLength"),f=a.get("minLength"),h=a.get("pattern");if(l&&(o||i)){var d="string"===l&&i,m="array"===l&&Array.isArray(i)&&i.length,v="array"===l&&j.default.List.isList(i)&&i.count(),g="file"===l&&i instanceof ee.default.File,y="boolean"===l&&(i||!1===i),_="number"===l&&(i||0===i),b="integer"===l&&(i||0===i);if(o&&!(d||m||v||g||y||_||b))return r.push("Required field is not provided"),r;if(h){var x=ve(i,h);x&&r.push(x)}if(p||0===p){var k=de(i,p);k&&r.push(k)}if(f){var w=me(i,f);w&&r.push(w)}if(s||0===s){var E=oe(i,s);E&&r.push(E)}if(u||0===u){var S=ae(i,u);S&&r.push(S)}if("string"===l){var C=void 0;if(!(C="date-time"===c?fe(i):"uuid"===c?he(i):pe(i)))return r;r.push(C)}else if("boolean"===l){var A=ce(i);if(!A)return r;r.push(A)}else if("number"===l){var D=se(i);if(!D)return r;r.push(D)}else if("integer"===l){var O=ue(i);if(!O)return r;r.push(O)}else if("array"===l){var T=void 0;if(!i.count())return r;T=a.getIn(["items","type"]),i.forEach(function(e,t){var n=void 0;"number"===T?n=se(e):"integer"===T?n=ue(e):"string"===T&&(n=pe(e)),n&&r.push({index:t,error:n})})}else if("file"===l){var M=le(i);if(!M)return r;r.push(M)}}return r},t.getSampleSchema=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(/xml/.test(t)){if(!e.xml||!e.xml.name){if(e.xml=e.xml||{},!e.$$ref)return e.type||e.items||e.properties||e.additionalProperties?'\n\x3c!-- XML example cannot be generated --\x3e':null;var r=e.$$ref.match(/\S*\/(\S+)$/);e.xml.name=r[1]}return(0,Z.memoizedCreateXMLExample)(e,n)}return(0,C.default)((0,Z.memoizedSampleFromSchema)(e,n),null,2)},t.parseSearch=function(){var e={},t=window.location.search;if(""!=t){var n=t.substr(1).split("&");for(var r in n)r=n[r].split("="),e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e},t.btoa=function(t){var n=void 0;return n=t instanceof e?t:new e(t.toString(),"utf-8"),n.toString("base64")},t.sorters={operationsSorter:{alpha:function(e,t){return e.get("path").localeCompare(t.get("path"))},method:function(e,t){return e.get("method").localeCompare(t.get("method"))}},tagsSorter:{alpha:function(e,t){return e.localeCompare(t)}}},t.buildFormData=function(e){var t=[];for(var n in e){var r=e[n];void 0!==r&&""!==r&&t.push([n,"=",encodeURIComponent(r).replace(/%20/g,"+")].join(""))}return t.join("&")},t.shallowEqualKeys=function(e,t,n){return!!(0,J.default)(n,function(n){return(0,$.default)(e[n],t[n])})},t.createDeepLinkPath=function(e){return"string"==typeof e||e instanceof String?e.trim().replace(/\s/g,"_"):""});t.escapeDeepLinkPath=function(e){return(0,ne.default)(ge(e))}}).call(t,n(50).Buffer)},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ +var i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,s,u=r(e),l=1;l=55296&&e<=57343)&&(!(e>=64976&&e<=65007)&&(65535!=(65535&e)&&65534!=(65535&e)&&(!(e>=0&&e<=8)&&(11!==e&&(!(e>=14&&e<=31)&&(!(e>=127&&e<=159)&&!(e>1114111)))))))}function l(e){if(e>65535){e-=65536;var t=55296+(e>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function c(e,t){var n=0;return o(y,t)?y[t]:35===t.charCodeAt(0)&&g.test(t)&&(n="x"===t[1].toLowerCase()?parseInt(t.slice(2),16):parseInt(t.slice(1),10),u(n))?l(n):e}function p(e){return e.indexOf("&")<0?e:e.replace(v,c)}function f(e){return x[e]}function h(e){return _.test(e)?e.replace(b,f):e}var d=Object.prototype.hasOwnProperty,m=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g,v=/&([a-z#][a-z0-9]{1,31});/gi,g=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,y=n(455),_=/[&<>"]/,b=/[&<>"]/g,x={"&":"&","<":"<",">":">",'"':"""};t.assign=a,t.isString=i,t.has=o,t.unescapeMd=s,t.isValidEntityCode=u,t.fromCodePoint=l,t.replaceEntities=p,t.escapeHtml=h},function(e,t,n){var r=n(342)("wks"),i=n(194),o=n(28).Symbol,a="function"==typeof o;(e.exports=function(e){return r[e]||(r[e]=a&&o[e]||(a?o:i)("Symbol."+e))}).store=r},function(e,t,n){"use strict";function r(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":e instanceof b.Iterable?"Immutable."+e.toSource().split(" ")[0]:t}function i(e){function t(t,n,r,i,o,a){for(var s=arguments.length,u=Array(s>6?s-6:0),l=6;l5?l-5:0),p=5;p5?a-5:0),u=5;u key("+c[p]+")"].concat(s));if(h instanceof Error)return h}}return i(t)}function u(e){return a(e,"List",b.List.isList)}function l(e,t,n,r){function o(){for(var i=arguments.length,o=Array(i),u=0;u5?s-5:0),l=5;l5?l-5:0),p=5;p>",k={listOf:u,mapOf:c,orderedMapOf:p,setOf:f,orderedSetOf:h,stackOf:d,iterableOf:m,recordOf:v,shape:y,contains:y,mapContains:_,list:o("List",b.List.isList),map:o("Map",b.Map.isMap),orderedMap:o("OrderedMap",b.OrderedMap.isOrderedMap),set:o("Set",b.Set.isSet),orderedSet:o("OrderedSet",b.OrderedSet.isOrderedSet),stack:o("Stack",b.Stack.isStack),seq:o("Seq",b.Seq.isSeq),record:o("Record",function(e){return e instanceof b.Record}),iterable:o("Iterable",b.Iterable.isIterable)};e.exports=k},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";function r(e){return function(){return e}}var i=function(){};i.thatReturns=r,i.thatReturnsFalse=r(!1),i.thatReturnsTrue=r(!0),i.thatReturnsNull=r(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(e){return e},e.exports=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.get("openapi");return!!t&&t.startsWith("3.0.0")}function o(e){var t=e.get("swagger");return!!t&&t.startsWith("2")}function a(e){return function(t,n){return function(r){if(n&&n.specSelectors&&n.specSelectors.specJson){return i(n.specSelectors.specJson())?c.default.createElement(e,(0,u.default)({},r,n,{Ori:t})):c.default.createElement(t,r)}return console.warn("OAS3 wrapper: couldn't get spec"),null}}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(20),u=r(s);t.isOAS3=i,t.isSwagger2=o,t.OAS3ComponentWrapFactory=a;var l=n(0),c=r(l)},function(e,t,n){e.exports={default:n(556),__esModule:!0}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(312),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e,t,n){return t in e?(0,i.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){var r=n(27);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){function n(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=n},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function o(e){if(p===clearTimeout)return clearTimeout(e);if((p===r||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function a(){m&&h&&(m=!1,h.length?d=h.concat(d):v=-1,d.length&&s())}function s(){if(!m){var e=i(a);m=!0;for(var t=d.length;t;){for(h=d,d=[];++v1)for(var n=1;n0&&(a=this.buffer[u-1],e.call(r,a)<0);)if(u--,this.pointer-u>n/2-1){o=" ... ",u+=5;break}for(l="",i=this.pointer;in/2-1){l=" ... ",i-=5;break}return""+new Array(t).join(" ")+o+this.buffer.slice(u,i)+l+"\n"+new Array(t+this.pointer-u+o.length).join(" ")+"^"},t.prototype.toString=function(){var e,t;return e=this.get_snippet(),t=" on line "+(this.line+1)+", column "+(this.column+1),e?t:t+":\n"+e},t}(),this.YAMLError=function(e){function n(e){this.message=e,n.__super__.constructor.call(this),this.stack=this.toString()+"\n"+(new Error).stack.split("\n").slice(1).join("\n")}return t(n,e),n.prototype.toString=function(){return this.message},n}(Error),this.MarkedYAMLError=function(e){function n(e,t,r,i,o){this.context=e,this.context_mark=t,this.problem=r,this.problem_mark=i,this.note=o,n.__super__.constructor.call(this)}return t(n,e),n.prototype.toString=function(){var e;return e=[],null!=this.context&&e.push(this.context),null==this.context_mark||null!=this.problem&&null!=this.problem_mark&&this.context_mark.line===this.problem_mark.line&&this.context_mark.column===this.problem_mark.column||e.push(this.context_mark.toString()),null!=this.problem&&e.push(this.problem),null!=this.problem_mark&&e.push(this.problem_mark.toString()),null!=this.note&&e.push(this.note),e.join("\n")},n}(this.YAMLError)}).call(this)},function(e,t,n){e.exports={default:n(555),__esModule:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(531),o=r(i),a=n(530),s=r(a),u="function"==typeof s.default&&"symbol"==typeof o.default?function(e){return typeof e}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":typeof e};t.default="function"==typeof s.default&&"symbol"===u(o.default)?function(e){return void 0===e?"undefined":u(e)}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":void 0===e?"undefined":u(e)}},function(e,t,n){e.exports=!n(52)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";function r(e,t,n){return n?[e,t]:e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var i=this.constructor.Interface;for(var o in i)if(i.hasOwnProperty(o)){var s=i[o];s?this[o]=s(n):"target"===o?this.target=r:this[o]=n[o]}var u=null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue;return this.isDefaultPrevented=u?a.thatReturnsTrue:a.thatReturnsFalse,this.isPropagationStopped=a.thatReturnsFalse,this}var i=n(12),o=n(65),a=n(29),s=(n(9),["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:a.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};i(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=a.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=a.thatReturnsTrue)},persist:function(){this.isPersistent=a.thatReturnsTrue},isPersistent:a.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function m(e){return+e!=e&&(e=0),o.alloc(+e)}function v(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(e).length;default:if(r)return V(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return D(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return M(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function _(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,i);if("number"==typeof t)return t&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var l;if(i){var c=-1;for(l=n;ls&&(n=s-u),l=n;l>=0;l--){for(var p=!0,f=0;fi&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=n){var u,l,c,p;switch(s){case 1:o<128&&(a=o);break;case 2:u=e[i+1],128==(192&u)&&(p=(31&o)<<6|63&u)>127&&(a=p);break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(p=(15&o)<<12|(63&u)<<6|63&l)>2047&&(p<55296||p>57343)&&(a=p);break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(p=(15&o)<<18|(63&u)<<12|(63&l)<<6|63&c)>65535&&p<1114112&&(a=p)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return O(r)}function O(e){var t=e.length;if(t<=Q)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function R(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function B(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function j(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,r,i){return i||j(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(e,t,n,r,23,4),n+4}function q(e,t,n,r,i){return i||j(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(e,t,n,r,52,8),n+8}function z(e){if(e=U(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function U(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function W(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function J(e){return Y.toByteArray(z(e))}function X(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function K(e){return e!==e}/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var Y=n(534),$=n(707),Z=n(366);t.Buffer=o,t.SlowBuffer=m,t.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=r(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,n){return a(null,e,t,n)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,n){return u(null,e,t,n)},o.allocUnsafe=function(e){return l(null,e)},o.allocUnsafeSlow=function(e){return l(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},o.prototype.compare=function(e,t,n,r,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,s=n-t,u=Math.min(a,s),l=this.slice(r,i),c=e.slice(t,n),p=0;pi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return k(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;o.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUInt8=function(e,t){return t||F(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||F(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||F(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||F(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return t||F(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||F(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){t||F(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return t||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||F(e,4,this.length),$.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||F(e,4,this.length),$.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||F(e,8,this.length),$.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||F(e,8,this.length),$.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){N(this,e,t,n,Math.pow(2,8*n)-1,0)}var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},o.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):B(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):B(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return q(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return q(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;a1?t-1:0),i=1;i2?n-2:0),o=2;o=n?e:e.length+1===n?""+t+e:""+new Array(n-e.length+1).join(t)+e},this.to_hex=function(e){return"string"==typeof e&&(e=e.charCodeAt(0)),e.toString(16)}}).call(this)}).call(t,n(18))},function(e,t,n){var r=n(101);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){"use strict";var r=n(668),i=Math.max;e.exports=function(e){return i(0,r(e))}},function(e,t,n){function r(e){return null==e?void 0===e?u:s:(e=Object(e),l&&l in e?o(e):a(e))}var i=n(76),o=n(837),a=n(866),s="[object Null]",u="[object Undefined]",l=i?i.toStringTag:void 0;e.exports=r},function(e,t,n){function r(e,t){var n=o(e,t);return i(n)?n:void 0}var i=n(795),o=n(838);e.exports=r},function(e,t){function n(e){return null!=e&&"object"==typeof e}e.exports=n},function(e,t,n){"use strict"},function(e,t,n){"use strict";var r=n(10),i=(n(7),function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)}),o=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},a=function(e,t,n){var r=this;if(r.instancePool.length){var i=r.instancePool.pop();return r.call(i,e,t,n),i}return new r(e,t,n)},s=function(e,t,n,r){var i=this;if(i.instancePool.length){var o=i.instancePool.pop();return i.call(o,e,t,n,r),o}return new i(e,t,n,r)},u=function(e){var t=this;e instanceof t||r("25"),e.destructor(),t.instancePool.length`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",u="]",l=new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|]*>|)","i"),c=/[\\&]/,p="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",f=new RegExp("\\\\"+p+"|"+a,"gi"),h=new RegExp('[&<>"]',"g"),d=new RegExp(a+'|[&<>"]',"gi"),m=function(e){return 92===e.charCodeAt(0)?e.charAt(1):o(e)},v=function(e){return c.test(e)?e.replace(f,m):e},g=function(e){try{return r(i(e))}catch(t){return e}},y=function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return e}},_=function(e,t){return h.test(e)?t?e.replace(d,y):e.replace(h,y):e};e.exports={unescapeString:v,normalizeURI:g,escapeXml:_,reHtmlTag:l,OPENTAG:s,CLOSETAG:u,ENTITY:a,ESCAPABLE:p}},function(e,t){e.exports={}},function(e,t,n){var r=n(172),i=n(169);e.exports=function(e){return r(i(e))}},function(e,t,n){var r=n(169);e.exports=function(e){return Object(r(e))}},function(e,t){var n=e.exports={version:"2.5.1"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(132),i=n(341);e.exports=n(99)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(351)();e.exports=function(e){return e!==r&&null!==e}},function(e,t,n){"use strict";function r(e){return void 0===e||null===e}function i(e){return"object"==typeof e&&null!==e}function o(e){return Array.isArray(e)?e:r(e)?[]:[e]}function a(e,t){var n,r,i,o;if(t)for(o=Object.keys(t),n=0,r=o.length;n`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",u="]",l=new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|]*>|)","i"),c=/[\\&]/,p="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",f=new RegExp("\\\\"+p+"|"+a,"gi"),h=new RegExp('[&<>"]',"g"),d=new RegExp(a+'|[&<>"]',"gi"),m=function(e){return 92===e.charCodeAt(0)?e.charAt(1):o(e)},v=function(e){return c.test(e)?e.replace(f,m):e},g=function(e){try{return r(i(e))}catch(t){return e}},y=function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return e}},_=function(e,t){return h.test(e)?t?e.replace(d,y):e.replace(h,y):e};e.exports={unescapeString:v,normalizeURI:g,escapeXml:_,reHtmlTag:l,OPENTAG:s,CLOSETAG:u,ENTITY:a,ESCAPABLE:p}},function(e,t,n){"use strict";var r=n(12),i=n(441),o=n(1026),a=n(1027),s=n(87),u=n(1028),l=n(1029),c=n(1030),p=n(1034),f=s.createElement,h=s.createFactory,d=s.cloneElement,m=r,v=function(e){return e},g={Children:{map:o.map,forEach:o.forEach,count:o.count,toArray:o.toArray,only:p},Component:i.Component,PureComponent:i.PureComponent,createElement:f,cloneElement:d,isValidElement:s.isValidElement,PropTypes:u,createClass:c,createFactory:h,createMixin:v,DOM:a,version:l,__spread:m};e.exports=g},function(e,t,n){"use strict";function r(e){return void 0!==e.ref}function i(e){return void 0!==e.key}var o=n(12),a=n(47),s=(n(9),n(445),Object.prototype.hasOwnProperty),u=n(443),l={key:!0,ref:!0,__self:!0,__source:!0},c=function(e,t,n,r,i,o,a){var s={$$typeof:u,type:e,key:t,ref:n,props:a,_owner:o};return s};c.createElement=function(e,t,n){var o,u={},p=null,f=null;if(null!=t){r(t)&&(f=t.ref),i(t)&&(p=""+t.key),void 0===t.__self?null:t.__self,void 0===t.__source?null:t.__source;for(o in t)s.call(t,o)&&!l.hasOwnProperty(o)&&(u[o]=t[o])}var h=arguments.length-2;if(1===h)u.children=n;else if(h>1){for(var d=Array(h),m=0;m1){for(var g=Array(v),y=0;y=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(527),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){n(589);for(var r=n(22),i=n(54),o=n(68),a=n(19)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u0&&void 0!==arguments[0]?arguments[0]:{};return{type:v,payload:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.CLEAR=t.NEW_AUTH_ERR=t.NEW_SPEC_ERR_BATCH=t.NEW_SPEC_ERR=t.NEW_THROWN_ERR_BATCH=t.NEW_THROWN_ERR=void 0,t.newThrownErr=r,t.newThrownErrBatch=i,t.newSpecErr=o,t.newSpecErrBatch=a,t.newAuthErr=s,t.clear=u;var l=n(248),c=function(e){return e&&e.__esModule?e:{default:e}}(l),p=t.NEW_THROWN_ERR="err_new_thrown_err",f=t.NEW_THROWN_ERR_BATCH="err_new_thrown_err_batch",h=t.NEW_SPEC_ERR="err_new_spec_err",d=t.NEW_SPEC_ERR_BATCH="err_new_spec_err_batch",m=t.NEW_AUTH_ERR="err_new_auth_err",v=t.CLEAR="err_clear"},function(e,t,n){var r=n(51),i=n(319),o=n(317),a=n(33),s=n(126),u=n(184),l={},c={},t=e.exports=function(e,t,n,p,f){var h,d,m,v,g=f?function(){return e}:u(e),y=r(n,p,t?2:1),_=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(o(g)){for(h=s(e.length);h>_;_++)if((v=t?y(a(d=e[_])[0],d[1]):y(e[_]))===l||v===c)return v}else for(m=g.call(e);!(d=m.next()).done;)if((v=i(m,y,d.value,t))===l||v===c)return v};t.BREAK=l,t.RETURN=c},function(e,t){e.exports=!0},function(e,t,n){var r=n(127)("meta"),i=n(27),o=n(53),a=n(37).f,s=0,u=Object.isExtensible||function(){return!0},l=!n(52)(function(){return u(Object.preventExtensions({}))}),c=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},p=function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!u(e))return"F";if(!t)return"E";c(e)}return e[r].i},f=function(e,t){if(!o(e,r)){if(!u(e))return!0;if(!t)return!1;c(e)}return e[r].w},h=function(e){return l&&d.NEED&&u(e)&&!o(e,r)&&c(e),e},d=e.exports={KEY:r,NEED:!1,fastKey:p,getWeak:f,onFreeze:h}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(180),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(128);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(28),i=n(71),o=n(72),a=n(103),s=n(130),u=function(e,t,n){var l,c,p,f,h=e&u.F,d=e&u.G,m=e&u.S,v=e&u.P,g=e&u.B,y=d?r:m?r[t]||(r[t]={}):(r[t]||{}).prototype,_=d?i:i[t]||(i[t]={}),b=_.prototype||(_.prototype={});d&&(n=t);for(l in n)c=!h&&y&&void 0!==y[l],p=(c?y:n)[l],f=g&&c?s(p,r):v&&"function"==typeof p?s(Function.call,p):p,y&&a(y,l,p,e&u.U),_[l]!=p&&o(_,l,f),v&&b[l]!=p&&(b[l]=p)};r.core=i,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},function(e,t,n){var r=n(59),i=n(609),o=n(627),a=Object.defineProperty;t.f=n(99)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){"use strict";var r,i=n(352),o=n(355),a=n(672),s=n(677);r=e.exports=function(e,t){var n,r,a,u,l;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],null==e?(n=a=!0,r=!1):(n=s.call(e,"c"),r=s.call(e,"e"),a=s.call(e,"w")),l={value:t,configurable:n,enumerable:r,writable:a},u?i(o(u),l):l},r.gs=function(e,t,n){var r,u,l,c;return"string"!=typeof e?(l=n,n=t,t=e,e=null):l=arguments[3],null==t?t=void 0:a(t)?null==n?n=void 0:a(n)||(l=n,n=void 0):(l=t,t=n=void 0),null==e?(r=!0,u=!1):(r=s.call(e,"c"),u=s.call(e,"e")),c={get:t,set:n,configurable:r,enumerable:u},l?i(o(l),c):c}},function(e,t,n){"use strict";e.exports=n(669)("forEach")},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],a(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(o(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),i=l.length,u=0;u0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){i=s;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";var r=n(75);e.exports=r.DEFAULT=new r({include:[n(111)],explicit:[n(748),n(747),n(746)]})},function(e,t,n){function r(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e]/;e.exports=i},function(e,t,n){"use strict";var r,i=n(23),o=n(225),a=/^[ \r\n\t\f]/,s=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,u=n(233),l=u(function(e,t){if(e.namespaceURI!==o.svg||"innerHTML"in e)e.innerHTML=t;else{r=r||document.createElement("div"),r.innerHTML=""+t+"";for(var n=r.firstChild;n.firstChild;)e.appendChild(n.firstChild)}});if(i.canUseDOM){var c=document.createElement("div");c.innerHTML=" ",""===c.innerHTML&&(l=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),a.test(t)||"<"===t[0]&&s.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t}),c=null}e.exports=l},function(e,t,n){"use strict";function r(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]="number"==typeof e[n]?e[n]:e[n].val);return t}t.__esModule=!0,t.default=r,e.exports=t.default},function(e,t,n){"use strict";e.exports=function(e,t){var n,r,i,o=-1,a=e.posMax,s=e.pos,u=e.isInLabel;if(e.isInLabel)return-1;if(e.labelUnmatchedScopes)return e.labelUnmatchedScopes--,-1;for(e.pos=t+1,e.isInLabel=!0,n=1;e.pos1&&void 0!==arguments[1])||arguments[1];return e=(0,s.normalizeArray)(e),{type:p,payload:{thing:e,shown:t}}}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e=(0,s.normalizeArray)(e),{type:c,payload:{thing:e,mode:t}}}Object.defineProperty(t,"__esModule",{value:!0}),t.SHOW=t.UPDATE_MODE=t.UPDATE_FILTER=t.UPDATE_LAYOUT=void 0,t.updateLayout=r,t.updateFilter=i,t.show=o,t.changeMode=a;var s=n(11),u=t.UPDATE_LAYOUT="layout_update_layout",l=t.UPDATE_FILTER="layout_update_filter",c=t.UPDATE_MODE="layout_update_mode",p=t.SHOW="layout_show"},function(e,t,n){"use strict";function r(e){return{type:u,payload:e}}function i(e){var t=e.value,n=e.pathMethod;return{type:l,payload:{value:t,pathMethod:n}}}function o(e){var t=e.value,n=e.pathMethod;return{type:c,payload:{value:t,pathMethod:n}}}function a(e){var t=e.value,n=e.path,r=e.method;return{type:p,payload:{value:t,path:n,method:r}}}function s(e){var t=e.server,n=e.key,r=e.val;return{type:f,payload:{server:t,key:n,val:r}}}Object.defineProperty(t,"__esModule",{value:!0}),t.setSelectedServer=r,t.setRequestBodyValue=i,t.setRequestContentType=o,t.setResponseContentType=a,t.setServerVariableValue=s;var u=t.UPDATE_SELECTED_SERVER="oas3_set_servers",l=t.UPDATE_REQUEST_BODY_VALUE="oas3_set_request_body_value",c=t.UPDATE_REQUEST_CONTENT_TYPE="oas3_set_request_content_type",p=t.UPDATE_RESPONSE_CONTENT_TYPE="oas3_set_response_content_type",f=t.UPDATE_SERVER_VARIABLE_VALUE="oas3_set_server_variable_value"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=h(e,t);if(n)return(0,s.default)(n,{declaration:!0,indent:"\t"})}Object.defineProperty(t,"__esModule",{value:!0}),t.memoizedSampleFromSchema=t.memoizedCreateXMLExample=t.sampleXmlFromSchema=t.inferSchema=t.sampleFromSchema=void 0,t.createXMLExample=i;var o=n(11),a=n(1125),s=r(a),u=n(910),l=r(u),c={string:function(){return"string"},string_email:function(){return"user@example.com"},"string_date-time":function(){return(new Date).toISOString()},number:function(){return 0},number_float:function(){return 0},integer:function(){return 0},boolean:function(e){return"boolean"!=typeof e.default||e.default}},p=function(e){e=(0,o.objectify)(e);var t=e,n=t.type,r=t.format,i=c[n+"_"+r]||c[n];return(0,o.isFunc)(i)?i(e):"Unknown Type: "+e.type},f=t.sampleFromSchema=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,o.objectify)(t),i=r.type,a=r.example,s=r.properties,u=r.additionalProperties,l=r.items,c=n.includeReadOnly,f=n.includeWriteOnly;if(void 0!==a)return a;if(!i)if(s)i="object";else{if(!l)return;i="array"}if("object"===i){var h=(0,o.objectify)(s),d={};for(var m in h)h[m].readOnly&&!c||h[m].writeOnly&&!f||(d[m]=e(h[m],n));if(!0===u)d.additionalProp1={};else if(u)for(var v=(0,o.objectify)(u),g=e(v,n),y=1;y<4;y++)d["additionalProp"+y]=g;return d}return"array"===i?[e(l,n)]:t.enum?t.default?t.default:(0,o.normalizeArray)(t.enum)[0]:"file"!==i?p(t):void 0},h=(t.inferSchema=function(e){return e.schema&&(e=e.schema),e.properties&&(e.type="object"),e},t.sampleXmlFromSchema=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,o.objectify)(t),i=r.type,a=r.properties,s=r.additionalProperties,u=r.items,l=r.example,c=n.includeReadOnly,f=n.includeWriteOnly,h=r.default,d={},m={},v=t.xml,g=v.name,y=v.prefix,_=v.namespace,b=r.enum,x=void 0,k=void 0;if(!i)if(a||s)i="object";else{if(!u)return;i="array"}if(g=g||"notagname",x=(y?y+":":"")+g,_){m[y?"xmlns:"+y:"xmlns"]=_}if("array"===i&&u){if(u.xml=u.xml||v||{},u.xml.name=u.xml.name||v.name,v.wrapped)return d[x]=[],Array.isArray(l)?l.forEach(function(t){u.example=t,d[x].push(e(u,n))}):Array.isArray(h)?h.forEach(function(t){u.default=t,d[x].push(e(u,n))}):d[x]=[e(u,n)],m&&d[x].push({_attr:m}),d;var w=[];return Array.isArray(l)?(l.forEach(function(t){u.example=t,w.push(e(u,n))}),w):Array.isArray(h)?(h.forEach(function(t){u.default=t,w.push(e(u,n))}),w):e(u,n)}if("object"===i){var E=(0,o.objectify)(a);d[x]=[],l=l||{};for(var S in E)if((!E[S].readOnly||c)&&(!E[S].writeOnly||f))if(E[S].xml=E[S].xml||{},E[S].xml.attribute){var C=Array.isArray(E[S].enum)&&E[S].enum[0],A=E[S].example,D=E[S].default;m[E[S].xml.name||S]=void 0!==A&&A||void 0!==l[S]&&l[S]||void 0!==D&&D||C||p(E[S])}else{E[S].xml.name=E[S].xml.name||S,E[S].example=void 0!==E[S].example?E[S].example:l[S];var O=e(E[S]);Array.isArray(O)?d[x]=d[x].concat(O):d[x].push(O)}return!0===s?d[x].push({additionalProp:"Anything can be here"}):s&&d[x].push({additionalProp:p(s)}),m&&d[x].push({_attr:m}),d}return k=void 0!==l?l:void 0!==h?h:Array.isArray(b)?b[0]:p(t),d[x]=m?[{_attr:m},k]:k,d});t.memoizedCreateXMLExample=(0,l.default)(i),t.memoizedSampleFromSchema=(0,l.default)(f)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){return e instanceof Error?{type:T,error:!0,payload:e}:"string"==typeof e?{type:T,payload:e.replace(/\t/g," ")||""}:{type:T,payload:""}}function o(e){return{type:W,payload:e}}function a(e){return{type:M,payload:e}}function s(e){if(!e||"object"!==(void 0===e?"undefined":(0,k.default)(e)))throw new Error("updateJson must only accept a simple JSON object");return{type:P,payload:e}}function u(e,t,n,r,i){return{type:I,payload:{path:e,value:r,paramName:t,paramIn:n,isXml:i}}}function l(e){return{type:z,payload:{pathMethod:e}}}function c(e,t){return{type:U,payload:{path:e,value:t,key:"consumes_value"}}}function p(e,t){return{type:U,payload:{path:e,value:t,key:"produces_value"}}}function f(e,t){return{type:L,payload:{path:e,method:t}}}function h(e,t){return{type:q,payload:{path:e,method:t}}}function d(e,t,n){return{type:V,payload:{scheme:e,path:t,method:n}}}Object.defineProperty(t,"__esModule",{value:!0}),t.execute=t.executeRequest=t.logRequest=t.setMutatedRequest=t.setRequest=t.setResponse=t.validateParams=t.formatIntoYaml=t.resolveSpec=t.parseToJson=t.SET_SCHEME=t.UPDATE_RESOLVED=t.UPDATE_OPERATION_VALUE=t.ClEAR_VALIDATE_PARAMS=t.CLEAR_REQUEST=t.CLEAR_RESPONSE=t.LOG_REQUEST=t.SET_MUTATED_REQUEST=t.SET_REQUEST=t.SET_RESPONSE=t.VALIDATE_PARAMS=t.UPDATE_PARAM=t.UPDATE_JSON=t.UPDATE_URL=t.UPDATE_SPEC=void 0;var m=n(20),v=r(m),g=n(90),y=r(g),_=n(31),b=r(_),x=n(43),k=r(x);t.updateSpec=i,t.updateResolved=o,t.updateUrl=a,t.updateJsonSpec=s,t.changeParam=u,t.clearValidateParams=l,t.changeConsumesValue=c,t.changeProducesValue=p,t.clearResponse=f,t.clearRequest=h,t.setScheme=d;var w=n(203),E=r(w),S=n(1115),C=r(S),A=n(248),D=r(A),O=n(11),T=t.UPDATE_SPEC="spec_update_spec",M=t.UPDATE_URL="spec_update_url",P=t.UPDATE_JSON="spec_update_json",I=t.UPDATE_PARAM="spec_update_param",F=t.VALIDATE_PARAMS="spec_validate_param",N=t.SET_RESPONSE="spec_set_response",R=t.SET_REQUEST="spec_set_request",B=t.SET_MUTATED_REQUEST="spec_set_mutated_request",j=t.LOG_REQUEST="spec_log_request",L=t.CLEAR_RESPONSE="spec_clear_response",q=t.CLEAR_REQUEST="spec_clear_request",z=t.ClEAR_VALIDATE_PARAMS="spec_clear_validate_param",U=t.UPDATE_OPERATION_VALUE="spec_update_operation_value",W=t.UPDATE_RESOLVED="spec_update_resolved",V=t.SET_SCHEME="set_scheme",H=(t.parseToJson=function(e){return function(t){var n=t.specActions,r=t.specSelectors,i=t.errActions,o=r.specStr,a=null;try{e=e||o(),i.clear({source:"parser"}),a=E.default.safeLoad(e)}catch(e){return console.error(e),i.newSpecErr({source:"parser",level:"error",message:e.reason,line:e.mark&&e.mark.line?e.mark.line+1:void 0})}return n.updateJsonSpec(a)}},t.resolveSpec=function(e,t){return function(n){var r=n.specActions,i=n.specSelectors,o=n.errActions,a=n.fn,s=a.fetch,u=a.resolve,l=a.AST,c=n.getConfigs,p=c(),f=p.modelPropertyMacro,h=p.parameterMacro,d=p.requestInterceptor,m=p.responseInterceptor;void 0===e&&(e=i.specJson()),void 0===t&&(t=i.url());var v=l.getLineNumberForPath,g=i.specStr();return u({fetch:s,spec:e,baseDoc:t,modelPropertyMacro:f,parameterMacro:h,requestInterceptor:d,responseInterceptor:m}).then(function(e){var t=e.spec,n=e.errors;if(o.clear({type:"thrown"}),n.length>0){var i=n.map(function(e){return console.error(e),e.line=e.fullPath?v(g,e.fullPath):null,e.path=e.fullPath?e.fullPath.join("."):null,e.level="error",e.type="thrown",e.source="resolver",Object.defineProperty(e,"message",{enumerable:!0,value:e.message}),e});o.newThrownErrBatch(i)}return r.updateResolved(t)})}},t.formatIntoYaml=function(){return function(e){var t=e.specActions,n=e.specSelectors,r=n.specStr,i=t.updateSpec;try{var o=E.default.safeDump(E.default.safeLoad(r()),{indent:2});i(o)}catch(e){i(e)}}},t.validateParams=function(e,t){return{type:F,payload:{pathMethod:e,isOAS3:t}}},t.setResponse=function(e,t,n){return{payload:{path:e,method:t,res:n},type:N}},t.setRequest=function(e,t,n){return{payload:{path:e,method:t,req:n},type:R}},t.setMutatedRequest=function(e,t,n){return{payload:{path:e,method:t,req:n},type:B}},t.logRequest=function(e){return{payload:e,type:j}},t.executeRequest=function(e){return function(t){var n=t.fn,r=t.specActions,i=t.specSelectors,o=t.getConfigs,a=t.oas3Selectors,s=e.pathName,u=e.method,l=e.operation,c=o(),p=c.requestInterceptor,f=c.responseInterceptor,h=l.toJS();if(e.contextUrl=(0,C.default)(i.url()).toString(),h&&h.operationId?e.operationId=h.operationId:h&&s&&u&&(e.operationId=n.opId(h,s,u)),i.isOAS3()){e.server=a.selectedServer(),e.serverVariables=a.serverVariables(e.server).toJS(),e.requestContentType=a.requestContentType(s,u),e.responseContentType=a.responseContentType(s,u)||"*/*";var d=a.requestBodyValue(s,u);(0,O.isJSONObject)(d)?e.requestBody=JSON.parse(d):e.requestBody=d}var m=(0,b.default)({},e);m=n.buildRequest(m),r.setRequest(e.pathName,e.method,m);var v=function(t){var n=p.apply(this,[t]),i=(0,b.default)({},n);return r.setMutatedRequest(e.pathName,e.method,i),n};e.requestInterceptor=v,e.responseInterceptor=f;var g=Date.now();return n.execute(e).then(function(t){t.duration=Date.now()-g,r.setResponse(e.pathName,e.method,t)}).catch(function(t){return r.setResponse(e.pathName,e.method,{error:!0,err:(0,D.default)(t)})})}},function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.path,n=e.method,r=(0,y.default)(e,["path","method"]);return function(e){var i=e.fn.fetch,o=e.specSelectors,a=e.specActions,s=o.spec().toJS(),u=o.operationScheme(t,n),l=o.contentTypeValues([t,n]).toJS(),c=l.requestContentType,p=l.responseContentType,f=/xml/i.test(c),h=o.parameterValues([t,n],f).toJS();return a.executeRequest((0,v.default)({fetch:i,spec:s,pathName:t,method:n,parameters:h,requestContentType:c,scheme:u,responseContentType:p},r))}});t.execute=H},function(e,t,n){"use strict";var r=n(11),i=n(1136);i.keys().forEach(function(t){if("./index.js"!==t){var n=i(t);e.exports[(0,r.pascalCaseFilename)(t)]=n.default?n.default:n}})},function(e,t,n){"use strict";function r(e){switch(e._type){case"document":case"block_quote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"link":case"image":case"custom_inline":case"custom_block":return!0;default:return!1}}var i=function(e,t){this.current=e,this.entering=!0===t},o=function(){var e=this.current,t=this.entering;if(null===e)return null;var n=r(e);return t&&n?e._firstChild?(this.current=e._firstChild,this.entering=!0):this.entering=!1:e===this.root?this.current=null:null===e._next?(this.current=e._parent,this.entering=!1):(this.current=e._next,this.entering=!0),{entering:t,node:e}},a=function(e){return{current:e,root:e,entering:!0,next:o,resumeAt:i}},s=function(e,t){this._type=e,this._parent=null,this._firstChild=null,this._lastChild=null,this._prev=null,this._next=null,this._sourcepos=t,this._lastLineBlank=!1,this._open=!0,this._string_content=null,this._literal=null,this._listData={},this._info=null,this._destination=null,this._title=null,this._isFenced=!1,this._fenceChar=null,this._fenceLength=0,this._fenceOffset=null,this._level=null,this._onEnter=null,this._onExit=null},u=s.prototype;Object.defineProperty(u,"isContainer",{get:function(){return r(this)}}),Object.defineProperty(u,"type",{get:function(){return this._type}}),Object.defineProperty(u,"firstChild",{get:function(){return this._firstChild}}),Object.defineProperty(u,"lastChild",{get:function(){return this._lastChild}}),Object.defineProperty(u,"next",{get:function(){return this._next}}),Object.defineProperty(u,"prev",{get:function(){return this._prev}}),Object.defineProperty(u,"parent",{get:function(){return this._parent}}),Object.defineProperty(u,"sourcepos",{get:function(){return this._sourcepos}}),Object.defineProperty(u,"literal",{get:function(){return this._literal},set:function(e){this._literal=e}}),Object.defineProperty(u,"destination",{get:function(){return this._destination},set:function(e){this._destination=e}}),Object.defineProperty(u,"title",{get:function(){return this._title},set:function(e){this._title=e}}),Object.defineProperty(u,"info",{get:function(){return this._info},set:function(e){this._info=e}}),Object.defineProperty(u,"level",{get:function(){return this._level},set:function(e){this._level=e}}),Object.defineProperty(u,"listType",{get:function(){return this._listData.type},set:function(e){this._listData.type=e}}),Object.defineProperty(u,"listTight",{get:function(){return this._listData.tight},set:function(e){this._listData.tight=e}}),Object.defineProperty(u,"listStart",{get:function(){return this._listData.start},set:function(e){this._listData.start=e}}),Object.defineProperty(u,"listDelimiter",{get:function(){return this._listData.delimiter},set:function(e){this._listData.delimiter=e}}),Object.defineProperty(u,"onEnter",{get:function(){return this._onEnter},set:function(e){this._onEnter=e}}),Object.defineProperty(u,"onExit",{get:function(){return this._onExit},set:function(e){this._onExit=e}}),s.prototype.appendChild=function(e){e.unlink(),e._parent=this,this._lastChild?(this._lastChild._next=e,e._prev=this._lastChild,this._lastChild=e):(this._firstChild=e,this._lastChild=e)},s.prototype.prependChild=function(e){e.unlink(),e._parent=this,this._firstChild?(this._firstChild._prev=e,e._next=this._firstChild,this._firstChild=e):(this._firstChild=e,this._lastChild=e)},s.prototype.unlink=function(){this._prev?this._prev._next=this._next:this._parent&&(this._parent._firstChild=this._next),this._next?this._next._prev=this._prev:this._parent&&(this._parent._lastChild=this._prev),this._parent=null,this._next=null,this._prev=null},s.prototype.insertAfter=function(e){e.unlink(),e._next=this._next,e._next&&(e._next._prev=e),e._prev=this,this._next=e,e._parent=this._parent,e._next||(e._parent._lastChild=e)},s.prototype.insertBefore=function(e){e.unlink(),e._prev=this._prev,e._prev&&(e._prev._next=e),e._next=this,this._prev=e,e._parent=this._parent,e._prev||(e._parent._firstChild=e)},s.prototype.walker=function(){return new a(this)},e.exports=s},function(e,t){var n=Object.prototype.toString;e.exports=function(e){switch(n.call(e)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===e?"null":void 0===e?"undefined":e!==e?"nan":e&&1===e.nodeType?"element":typeof(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e))}},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var r=n(51),i=n(172),o=n(70),a=n(126),s=n(569);e.exports=function(e,t){var n=1==e,u=2==e,l=3==e,c=4==e,p=6==e,f=5==e||p,h=t||s;return function(t,s,d){for(var m,v,g=o(t),y=i(g),_=r(s,d,3),b=a(y.length),x=0,k=n?h(t,b):u?h(t,0):void 0;b>x;x++)if((f||x in y)&&(m=y[x],v=_(m,x,g),e))if(n)k[x]=v;else if(v)switch(e){case 3:return!0;case 5:return m;case 6:return x;case 2:k.push(m)}else if(c)return!1;return p?-1:l||c?c:k}}},function(e,t,n){var r=n(93),i=n(19)("toStringTag"),o="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),i))?n:o?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(27),i=n(22).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(93);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){"use strict";function r(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=i(t),this.reject=i(n)}var i=n(92);e.exports.f=function(e){return new r(e)}},function(e,t,n){var r=n(33),i=n(578),o=n(171),a=n(178)("IE_PROTO"),s=function(){},u=function(){var e,t=n(170)("iframe"),r=o.length;for(t.style.display="none",n(315).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("